Handle case when item text is empty.

According to MSDN, length should be returned when lParam is NULL.
This commit is contained in:
Ulrich Czekalla 2004-06-02 21:34:05 +00:00 committed by Alexandre Julliard
parent ed3d86f9be
commit 0178c1116b
1 changed files with 9 additions and 5 deletions

View File

@ -3297,9 +3297,7 @@ TOOLBAR_GetButtonTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
INT nIndex;
LPWSTR lpText;
if (lParam == 0)
return -1;
LRESULT ret = 0;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
@ -3307,9 +3305,15 @@ TOOLBAR_GetButtonTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]);
strcpyW ((LPWSTR)lParam, lpText);
if (lpText)
{
ret = strlenW (lpText);
return strlenW (lpText);
if (lParam)
strcpyW ((LPWSTR)lParam, lpText);
}
return ret;
}