diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index 90675eb71e..e1fdab9e2d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -202,17 +202,17 @@ static Int getListboxBottomEntry( ListboxData *list ) { Int entry; - // determin which entry is at the top of the display area + // determine which entry is at the top of the display area for( entry=list->endPos - 1; ; entry-- ) { + if( entry < 0 ) + return 0; if( list->listData[entry].listHeight == list->displayPos + list->displayHeight ) return entry; if( list->listData[entry].listHeight < list->displayPos + list->displayHeight && entry != list->endPos - 1) return entry + 1; if( list->listData[entry].listHeight < list->displayPos + list->displayHeight) return entry; - if( entry < 0 ) - return 0; } return 0; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index cb616a1ae0..98b8593f34 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -202,17 +202,17 @@ static Int getListboxBottomEntry( ListboxData *list ) { Int entry; - // determin which entry is at the top of the display area + // determine which entry is at the top of the display area for( entry=list->endPos - 1; ; entry-- ) { + if( entry < 0 ) + return 0; if( list->listData[entry].listHeight == list->displayPos + list->displayHeight ) return entry; if( list->listData[entry].listHeight < list->displayPos + list->displayHeight && entry != list->endPos - 1) return entry + 1; if( list->listData[entry].listHeight < list->displayPos + list->displayHeight) return entry; - if( entry < 0 ) - return 0; } return 0;