Handle exceptions in int conversions (#2092)

* RageUtil: Add exception-safe wrappers around std::stoi, stol, stoll

* Replace use of std::stoi with exception-safe StringToInt
This commit is contained in:
Gareth Francis
2021-02-15 20:36:51 +00:00
committed by GitHub
parent c7c54bb013
commit aeb5c7598f
25 changed files with 124 additions and 73 deletions
+3 -3
View File
@@ -402,16 +402,16 @@ void BGAnimationLayer::LoadFromNode( const XNode* pNode )
{
m_Type = TYPE_TILES;
}
else if( std::stoi(type) == 1 )
else if( StringToInt(type) == 1 )
{
m_Type = TYPE_SPRITE;
bStretch = true;
}
else if( std::stoi(type) == 2 )
else if( StringToInt(type) == 2 )
{
m_Type = TYPE_PARTICLES;
}
else if( std::stoi(type) == 3 )
else if( StringToInt(type) == 3 )
{
m_Type = TYPE_TILES;
}