[Plib-devel] [PATCH] puListBox.cxx: don't crash with empty list + setTopItem(0)
Brought to you by:
sjbaker
From: Melchior F. <mf...@us...> - 2006-04-18 15:19:10
|
The attached patch makes sure that plib doesn't crash if a puListBox was created with an empty list and the top item is set to 0 (which happens on "up" arrow in puList, for example). In this case else if ( top > num-1 ) evaluates to (0 > -1) -> true, which sets top = num-1; -> -1 which accesses invalid memory with list[-1] in puListBox.cxx:135. m. |