From b522d42d814e411cfae95711ce6731e5c04b7c63 Mon Sep 17 00:00:00 2001 From: Sergey Khodych Date: Wed, 3 Jun 2009 12:34:37 +0300 Subject: comctl32:rebar: Don't store an empty string in REBAR_InsertBandT. --- dlls/comctl32/rebar.c | 12 ++++++++---- dlls/comctl32/tests/rebar.c | 9 +++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index 982c844..43e7ed9 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -2431,10 +2431,14 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnico } if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { - if (bUnicode) - Str_SetPtrW(&lpBand->lpText, lprbbi->lpText); - else - Str_SetPtrAtoW(&lpBand->lpText, (LPSTR)lprbbi->lpText); + if (bUnicode) { + if (*lprbbi->lpText) + Str_SetPtrW(&lpBand->lpText, lprbbi->lpText); + } + else { + if (*(LPSTR)lprbbi->lpText) + Str_SetPtrAtoW(&lpBand->lpText, (LPSTR)lprbbi->lpText); + } } REBAR_ValidateBand (infoPtr, lpBand); diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c index d055d8a..0064c45 100644 --- a/dlls/comctl32/tests/rebar.c +++ b/dlls/comctl32/tests/rebar.c @@ -289,6 +289,9 @@ rbsize_result_t rbsize_results[] = { { { 0, 0, 90, 65}, 0x40, 90}, { { 90, 0, 163, 65}, 0x40, 90}, { {163, 0, 226, 65}, 0x40, 90}, }, }, + { {0, 0, 672, 20}, 20, 1, {20, }, 2, { + { { 0, 0, 83, 20}, 0x00, 83}, { {83, 0, 672, 20}, 0x00, 589}, + }, }, }; static int rbsize_numtests = 0; @@ -502,6 +505,12 @@ static void layout_test(void) SendMessageA(hRebar, RB_INSERTBAND, -1, (LPARAM)&rbi); check_sizes(); + rebuild_rebar(&hRebar); + add_band_w(hRebar, "", 70, 90, 100); + add_band_w(hRebar, NULL, 40, 70, 100); + SendMessageA(hRebar, RB_MAXIMIZEBAND, 1, FALSE); + check_sizes(); + DestroyWindow(hRebar); } -- 1.5.3.3