From c646d0371cdb1d62e91598879db673038d501ed0 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 15 Jun 2013 00:31:51 +0000 Subject: [PATCH] updated to throw exception (not assert) when item missing from listbox --- source/glest_game/facilities/components.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/glest_game/facilities/components.cpp b/source/glest_game/facilities/components.cpp index 091b9f5c7..160a53bf1 100644 --- a/source/glest_game/facilities/components.cpp +++ b/source/glest_game/facilities/components.cpp @@ -11,7 +11,7 @@ #include "components.h" -#include +//#include #include #include "metrics.h" @@ -410,7 +410,10 @@ void GraphicListBox::setItems(const vector &items, const vector } void GraphicListBox::setSelectedItemIndex(int index, bool errorOnMissing){ - if(errorOnMissing == true) assert(index>=0 && index=0 && index= items.size())) { + throw megaglest_runtime_error("Index not found on list box: " + intToStr(index) + " size: " + intToStr(items.size())); + } selectedItemIndex= index; setText(getSelectedItem()); }