Fix memory error for listbox when clicking in the region where there are no items

This commit is contained in:
kreatordxx 2010-03-14 01:54:34 +00:00
parent f3ca7b4067
commit 40ecc65268
2 changed files with 5 additions and 1 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20100313
--------
main/newmenu.c: Fix memory error for listbox when clicking in the region where there are no items
20100310
--------
main/titles.c: Put most local variables in show_briefing in 'briefing' struct, to make briefing a window in future

View file

@ -1859,7 +1859,7 @@ int listbox_idle(window *wind, listbox *lb)
mouse_get_pos(&mx, &my, &mz);
for (i=lb->first_item; i<lb->first_item+LB_ITEMS_ON_SCREEN; i++ ) {
if (i > lb->nitems)
if (i >= lb->nitems)
break;
gr_get_string_size(lb->item[i], &w, &h, &aw );
x1 = lb->box_x;