[v2 PATCH] comctl32/toolbar: Handle NULL string pointer from TBN_GETINFOTIPW.

Nikolay Sivov nsivov at codeweavers.com
Thu Nov 28 01:14:39 CST 2019


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---

v2: fixed notification name in the comment

 dlls/comctl32/tests/toolbar.c | 4 ++++
 dlls/comctl32/toolbar.c       | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 41807258f4..3688394d71 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -159,6 +159,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam)
             break;
 
         case TBN_GETINFOTIPA:
+        case TBN_GETINFOTIPW:
         {
             NMTBGETINFOTIPA *tbgit = (NMTBGETINFOTIPA*)lParam;
 
@@ -2029,6 +2030,9 @@ static void test_tooltip(void)
 
     g_ResetDispTextPtr = TRUE;
     SendMessageA(hToolbar, WM_NOTIFY, 0, (LPARAM)&nmtti);
+    /* Same for TBN_GETINFOTIPW */
+    SendMessageA(hToolbar, TB_SETUNICODEFORMAT, TRUE, 0);
+    SendMessageA(hToolbar, WM_NOTIFY, 0, (LPARAM)&nmtti);
     g_ResetDispTextPtr = FALSE;
 
     DestroyWindow(hToolbar);
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index ceab5328bc..c302e6c111 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -6149,7 +6149,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
 
         TRACE("TBN_GETINFOTIPW - got string %s\n", debugstr_w(tbgit.pszText));
 
-        len = lstrlenW(tbgit.pszText);
+        len = tbgit.pszText ? lstrlenW(tbgit.pszText) : 0;
         if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
         {
             /* need to allocate temporary buffer in infoPtr as there
-- 
2.24.0




More information about the wine-devel mailing list