From fe9a0f097761b9cad76300dda4ef0fc795df7ab6 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Thu, 4 Jan 2001 19:27:03 +0000 Subject: [PATCH] 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. --- controls/listbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controls/listbox.c b/controls/listbox.c index 06faf135995..075c75b5f2d 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -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. */ -- 2.11.4.GIT