From 1fb5469cb311a690379ae2aa1ecb59ce9dd65331 Mon Sep 17 00:00:00 2001 From: auria Date: Tue, 26 Apr 2011 17:22:11 +0000 Subject: [PATCH] Fixed crash in ListWidget::getSelectionInternalName when nothing is selected git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8464 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/guiengine/widgets/list_widget.cpp | 1 + src/states_screens/addons_screen.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/guiengine/widgets/list_widget.cpp b/src/guiengine/widgets/list_widget.cpp index 3204ed727..a88a57509 100644 --- a/src/guiengine/widgets/list_widget.cpp +++ b/src/guiengine/widgets/list_widget.cpp @@ -144,6 +144,7 @@ void ListWidget::renameItem(const int itemID, const irr::core::stringw newName, std::string ListWidget::getSelectionInternalName() { + if (getSelectionID() == -1) return ""; return m_items[ getSelectionID() ].m_internal_name; } diff --git a/src/states_screens/addons_screen.cpp b/src/states_screens/addons_screen.cpp index 4a8123f30..aeb2cb70c 100644 --- a/src/states_screens/addons_screen.cpp +++ b/src/states_screens/addons_screen.cpp @@ -132,7 +132,10 @@ void AddonsScreen::eventCallback(GUIEngine::Widget* widget, getWidget("list_addons"); std::string id = list->getSelectionInternalName(); - new AddonsLoading(0.8f, 0.8f, id); + if (!id.empty()) + { + new AddonsLoading(0.8f, 0.8f, id); + } } if (name == "category") {