From e0361765ab3bea4eae6d970176032dc6f4ce2df3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 1 Aug 2016 12:18:51 +0300 Subject: [PATCH] comctl32/listview: Remove redundant check in LVM_DELETECOLUMN handler. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/comctl32/listview.c | 4 ++-- dlls/comctl32/tests/listview.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index a32c5941d80..6ab360b6639 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -5621,8 +5621,8 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) TRACE("nColumn=%d\n", nColumn); - if (nColumn < 0 || DPA_GetPtrCount(infoPtr->hdpaColumns) == 0 - || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; + if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) + return FALSE; /* While the MSDN specifically says that column zero should not be deleted, what actually happens is that the column itself is deleted but no items or subitems diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 8214d7b97ca..97f611fca92 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -1420,6 +1420,12 @@ static void test_columns(void) 10, 10, 100, 200, hwndparent, NULL, NULL, NULL); ok(hwnd != NULL, "failed to create listview window\n"); + rc = SendMessageA(hwnd, LVM_DELETECOLUMN, -1, 0); + ok(!rc, "got %d\n", rc); + + rc = SendMessageA(hwnd, LVM_DELETECOLUMN, 0, 0); + ok(!rc, "got %d\n", rc); + /* Add a column with no mask */ memset(&column, 0xcc, sizeof(column)); column.mask = 0;