Skip to content

Commit

Permalink
Fix uncaught exception in console when trying to parse invalid numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Feb 17, 2019
1 parent 25c1b13 commit 46cd49b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gui/game/SampleTool.cpp
Expand Up @@ -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);
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/lua/TPTScriptInterface.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit 46cd49b

Please sign in to comment.