Fix uncaught exception in console when trying to parse invalid numbers

This commit is contained in:
jacob1 2019-02-16 19:20:55 -05:00
parent 25c1b13bd4
commit 46cd49ba24
2 changed files with 9 additions and 2 deletions

View File

@ -54,7 +54,7 @@ void SampleTool::Draw(Simulation * sim, Brush * brush, ui::Point position)
for(std::vector<Tool*>::iterator iter = elementTools.begin(), end = elementTools.end(); iter != end; ++iter)
{
Tool * elementTool = *iter;
if(elementTool && (elementTool->GetToolID() >> PMAPBITS) == particleCtype)
if(elementTool && ID(elementTool->GetToolID()) == particleCtype)
gameModel->SetActiveTool(0, elementTool);
}
}

View File

@ -150,7 +150,14 @@ int TPTScriptInterface::parseNumber(String str)
}
else
{
return str.ToNumber<int>();
try
{
return str.ToNumber<int>();
}
catch (std::exception & e)
{
throw GeneralException(ByteString(e.what()).FromUtf8());
}
}
return currentNumber;
}