Jactry Zeng : riched20: Handle NULL in ITextServices::{TxGetHScroll, TxGetVScroll}.

Alexandre Julliard julliard at winehq.org
Fri Sep 7 16:49:25 CDT 2018


Module: wine
Branch: master
Commit: 563bfdfc18605f4c1c43964378cf21d416426ab8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=563bfdfc18605f4c1c43964378cf21d416426ab8

Author: Jactry Zeng <jzeng at codeweavers.com>
Date:   Fri Sep  7 16:01:26 2018 +0800

riched20: Handle NULL in ITextServices::{TxGetHScroll, TxGetVScroll}.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43488
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/tests/txtsrv.c | 20 ++++++++++++++++++++
 dlls/riched20/txtsrv.c       | 30 ++++++++++++++++++++----------
 2 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
index 4dee5fd..a8cf6ff 100644
--- a/dlls/riched20/tests/txtsrv.c
+++ b/dlls/riched20/tests/txtsrv.c
@@ -990,6 +990,25 @@ static void test_default_format(void)
     ITextHost_Release(host);
 }
 
+static void test_TxGetScroll(void)
+{
+    ITextServices *txtserv;
+    ITextHost *host;
+    HRESULT ret;
+
+    if (!init_texthost(&txtserv, &host))
+        return;
+
+    ret = ITextServices_TxGetHScroll(txtserv, NULL, NULL, NULL, NULL, NULL);
+    ok(ret == S_OK, "ITextSerHices_GetVScroll failed: 0x%08x.\n", ret);
+
+    ret = ITextServices_TxGetVScroll(txtserv, NULL, NULL, NULL, NULL, NULL);
+    ok(ret == S_OK, "ITextServices_GetVScroll failed: 0x%08x.\n", ret);
+
+    ITextServices_Release(txtserv);
+    ITextHost_Release(host);
+}
+
 START_TEST( txtsrv )
 {
     ITextServices *txtserv;
@@ -1021,6 +1040,7 @@ START_TEST( txtsrv )
         test_TxDraw();
         test_QueryInterface();
         test_default_format();
+        test_TxGetScroll();
     }
     if (wrapperCodeMem) VirtualFree(wrapperCodeMem, 0, MEM_RELEASE);
 }
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index eb61e4e..ee65621 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -182,11 +182,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, LONG
 {
    ITextServicesImpl *This = impl_from_ITextServices(iface);
 
-   *plMin = This->editor->horz_si.nMin;
-   *plMax = This->editor->horz_si.nMax;
-   *plPos = This->editor->horz_si.nPos;
-   *plPage = This->editor->horz_si.nPage;
-   *pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0;
+   if (plMin)
+      *plMin = This->editor->horz_si.nMin;
+   if (plMax)
+      *plMax = This->editor->horz_si.nMax;
+   if (plPos)
+      *plPos = This->editor->horz_si.nPos;
+   if (plPage)
+      *plPage = This->editor->horz_si.nPage;
+   if (pfEnabled)
+      *pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0;
    return S_OK;
 }
 
@@ -195,11 +200,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, LONG
 {
    ITextServicesImpl *This = impl_from_ITextServices(iface);
 
-   *plMin = This->editor->vert_si.nMin;
-   *plMax = This->editor->vert_si.nMax;
-   *plPos = This->editor->vert_si.nPos;
-   *plPage = This->editor->vert_si.nPage;
-   *pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0;
+   if (plMin)
+      *plMin = This->editor->vert_si.nMin;
+   if (plMax)
+      *plMax = This->editor->vert_si.nMax;
+   if (plPos)
+      *plPos = This->editor->vert_si.nPos;
+   if (plPage)
+      *plPage = This->editor->vert_si.nPage;
+   if (pfEnabled)
+      *pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0;
    return S_OK;
 }
 




More information about the wine-cvs mailing list