Fix uncaught exception in console when trying to parse invalid numbers
This commit is contained in:
parent
25c1b13bd4
commit
46cd49ba24
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user