Skip to content
Permalink
Browse files

Fix uncaught exception in console when trying to parse invalid numbers

  • Loading branch information...
jacob1 committed Feb 17, 2019
1 parent 25c1b13 commit 46cd49ba244a465d51ae6454cc4b2b6935844818
Showing with 9 additions and 2 deletions.
  1. +1 −1 src/gui/game/SampleTool.cpp
  2. +8 −1 src/lua/TPTScriptInterface.cpp
@@ -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;
}

0 comments on commit 46cd49b

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.