treeview.c

Aric Stewart aric at codeweavers.com
Thu Jan 31 10:47:22 CST 2002


This is a bit of a cover to help find other problems, but we would crash
if trying to sort a treeview with null strings in it. This prevents this
crash so that one can try to figure out why we have empty strings.

CHANGELOG: prevent crash on sorting treeview with null strings

-aric
-------------- next part --------------
Index: dlls/comctl32/treeview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.95
diff -u -u -r1.95 treeview.c
--- dlls/comctl32/treeview.c	2001/12/11 00:15:11	1.95
+++ dlls/comctl32/treeview.c	2002/01/31 14:43:11
@@ -2677,7 +2677,14 @@
     TREEVIEW_UpdateDispInfo(infoPtr, first, TVIF_TEXT);
     TREEVIEW_UpdateDispInfo(infoPtr, second, TVIF_TEXT);
 
-    return strcasecmp(first->pszText, second->pszText);
+    if (first->pszText && second->pszText)
+        return strcasecmp(first->pszText, second->pszText);
+    else if (first->pszText)
+        return -1;
+    else if (second->pszText)
+        return 1;
+    else
+        return 0;
 }
 
 /* Returns the number of physical children belonging to item. */


More information about the wine-patches mailing list