[PATCH 2/3] comctl32/listview: Remove redundant check in LVM_DELETECOLUMN handler

Nikolay Sivov nsivov at codeweavers.com
Mon Aug 1 04:18:51 CDT 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 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 a32c594..6ab360b 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 86070be..03e7cbc 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -1422,6 +1422,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;
-- 
2.8.1




More information about the wine-patches mailing list