Fixed a problem where when deleting an item using index -1 on an empty
listbox we would pass through an illegal negative index and cause
problems.
diff --git a/controls/listbox.c b/controls/listbox.c
index 06faf13..075c75b 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -1587,7 +1587,7 @@
LB_ITEMDATA *item;
INT max_items;
- if (index == -1) index = descr->nb_items - 1;
+ if ((index == -1) && (descr->nb_items > 0)) index = descr->nb_items - 1;
else if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
/* We need to invalidate the original rect instead of the updated one. */