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
This commit is contained in:
auria 2011-04-26 17:22:11 +00:00
parent e6168f8ad7
commit 1fb5469cb3
2 changed files with 5 additions and 1 deletions

View File

@ -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;
}

View File

@ -132,7 +132,10 @@ void AddonsScreen::eventCallback(GUIEngine::Widget* widget,
getWidget<GUIEngine::ListWidget>("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")
{