From 8730e4572dad25a63e4c08178a750dcccc7cc815 Mon Sep 17 00:00:00 2001 From: Francis Beaudet Date: Thu, 25 Mar 1999 13:22:02 +0000 Subject: [PATCH] Fixed LB_GETCURSEL message to return LB_ERR on empty list. --- controls/listbox.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/controls/listbox.c b/controls/listbox.c index 736922ad2e9..6f8a4696ec6 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -2228,8 +2228,13 @@ LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg, case LB_GETCURSEL16: case LB_GETCURSEL: - retvalue = descr->selected_item; - if (retvalue == -1) retvalue = descr->focus_item; + if (descr->nb_items==0) + retvalue = LB_ERR; + else + { + retvalue = descr->selected_item; + if (retvalue == -1) retvalue = descr->focus_item; + } /* otherwise, if the user tries to move the selection with the */ /* arrow keys, we will give the application something to choke on */ goto END;