"Aric" == Aric Stewart aric@codeweavers.com writes:
Aric> This is a bit of a cover to help find other problems, but we would Aric> crash if trying to sort a treeview with null strings in it. This Aric> prevents this crash so that one can try to figure out why we have Aric> empty strings.
Aric> CHANGELOG: prevent crash on sorting treeview with null strings
Aric> - return strcasecmp(first->pszText, second->pszText); + if Aric> (first->pszText && second->pszText) + return Aric> strcasecmp(first->pszText, second->pszText); + else if Aric> (first->pszText) + return -1; + else if (second->pszText) + return Aric> 1; + else + return 0; }
Should this fail silently?
Bye
It doesn't really fail silently as one will see the visual error of the text string being empty. It does prevent the application from crashing so someone can investigate why the item is empty.
Do you think there should be a warn or err message? I could add that but found it seemed to be messy.
-aric
Uwe Bonnes wrote:
"Aric" == Aric Stewart aric@codeweavers.com writes:
Aric> This is a bit of a cover to help find other problems, but we would Aric> crash if trying to sort a treeview with null strings in it. This Aric> prevents this crash so that one can try to figure out why we have Aric> empty strings. Aric> CHANGELOG: prevent crash on sorting treeview with null strings Aric> - return strcasecmp(first->pszText, second->pszText); + if Aric> (first->pszText && second->pszText) + return Aric> strcasecmp(first->pszText, second->pszText); + else if Aric> (first->pszText) + return -1; + else if (second->pszText) + return Aric> 1; + else + return 0; }
Should this fail silently?
Bye
Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------