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.
This commit is contained in:
Aric Stewart 2001-01-04 19:27:03 +00:00 committed by Alexandre Julliard
parent 1dc755360b
commit fe9a0f0977

View file

@ -1587,7 +1587,7 @@ static LRESULT LISTBOX_RemoveItem( WND *wnd, LB_DESCR *descr, INT index )
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. */