Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/riched20/tests/txtsrv.c | 3 +++ dlls/riched20/txtsrv.c | 3 +++ 2 files changed, 6 insertions(+)
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c index 73ca7cd753..5f261889f7 100644 --- a/dlls/riched20/tests/txtsrv.c +++ b/dlls/riched20/tests/txtsrv.c @@ -652,6 +652,9 @@ static void test_TxGetText(void) if (!init_texthost(&txtserv, &host)) return;
+ hres = ITextServices_TxGetText(txtserv, NULL); + ok(hres == E_INVALIDARG, "ITextServices_TxGetText should fail (result = %x)\n", hres); + hres = ITextServices_TxGetText(txtserv, &rettext); ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c index eb61e4eff6..8e9737e4a1 100644 --- a/dlls/riched20/txtsrv.c +++ b/dlls/riched20/txtsrv.c @@ -261,6 +261,9 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface, BSTR *p ITextServicesImpl *This = impl_from_ITextServices(iface); int length;
+ if (!pbstrText) + return E_INVALIDARG; + length = ME_GetTextLength(This->editor); if (length) {