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) {
On Wed, Apr 25, 2018 at 04:33:55PM +0800, Jactry Zeng wrote:
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) {
Does an application actually need this?
Huw.
Huw Davies huw@codeweavers.com 于2018年4月26日周四 下午6:11写道:
Does an application actually need this?
No, just noticed this when writing tests for TxGetNaturalSize.
-- Regards, Jactry Zeng
On 26 Apr 2018, at 11:33, Jactry Zeng jactry92@gmail.com wrote:
Huw Davies huw@codeweavers.com 于2018年4月26日周四 下午6:11写道:
Does an application actually need this?
No, just noticed this when writing tests for TxGetNaturalSize.
We don’t really want these sort of checks unless they’re actually required.
Huw.