Fix crash when searching in element search ui

This commit is contained in:
jacob1 2019-04-17 23:49:27 -04:00
parent e1d32c9352
commit 711453ad65

View File

@ -95,9 +95,9 @@ ElementSearchActivity::ElementSearchActivity(GameController * gameController, st
void ElementSearchActivity::searchTools(String query)
{
firstResult = NULL;
for(std::vector<ToolButton*>::iterator iter = toolButtons.begin(), end = toolButtons.end(); iter != end; ++iter) {
delete *iter;
RemoveComponent(*iter);
for (auto &toolButton : toolButtons) {
RemoveComponent(toolButton);
delete toolButton;
}
toolButtons.clear();