comctl32: Add a check for setting number of parts in the statusbar to zero.
authorPeter Urbanec <winehq.org@urbanec.net>
Tue, 1 Mar 2011 01:01:42 +0000 (12:01 +1100)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 1 Mar 2011 12:21:58 +0000 (13:21 +0100)
dlls/comctl32/status.c
dlls/comctl32/tests/status.c

index d67037034067449dfc5f4fd6b9a26bd7db9ce1d0..427fb76f629a1c1ffad9eea95d2b8ca091d3a852 100644 (file)
@@ -665,6 +665,8 @@ STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
 
     TRACE("(%d,%p)\n", count, parts);
 
+    if(!count) return FALSE;
+
     oldNumParts = infoPtr->numParts;
     infoPtr->numParts = count;
     if (oldNumParts > infoPtr->numParts) {
index c46b6145cfd94ab6941549e7aca0ef39797eb47d..8509674402806b46378f2a8e547d5d2abe0bcf71 100644 (file)
@@ -382,6 +382,12 @@ static void test_status_control(void)
     /* Reset number of parts */
     r = SendMessage(hWndStatus, SB_SETPARTS, 2, (LPARAM)nParts);
     expect(TRUE,r);
+    r = SendMessage(hWndStatus, SB_GETPARTS, 0, 0);
+    ok(r == 2, "Expected 2, got %d\n", r);
+    r = SendMessage(hWndStatus, SB_SETPARTS, 0, 0);
+    expect(FALSE,r);
+    r = SendMessage(hWndStatus, SB_GETPARTS, 0, 0);
+    ok(r == 2, "Expected 2, got %d\n", r);
 
     /* Set the minimum height and get rectangle information again */
     SendMessage(hWndStatus, SB_SETMINHEIGHT, 50, 0);