Fix crash when BuildMenus() is run with elements in the favorites menu

This commit is contained in:
jacob1 2016-07-24 17:30:00 -04:00
parent 9cae1f0fe7
commit fe4653c30e

View File

@ -233,9 +233,11 @@ void GameModel::BuildMenus()
activeToolIdentifiers[3] = regularToolset[3]->GetIdentifier(); activeToolIdentifiers[3] = regularToolset[3]->GetIdentifier();
//Empty current menus //Empty current menus
for(std::vector<Menu*>::iterator iter = menuList.begin(), end = menuList.end(); iter != end; ++iter) for (size_t i = 0; i < menuList.size(); i++)
{ {
delete *iter; if (i == SC_FAVORITES)
menuList[i]->ClearTools();
delete menuList[i];
} }
menuList.clear(); menuList.clear();
toolList.clear(); toolList.clear();