1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

Fix adventure map movement segfault in some scenarios

This commit is contained in:
Vadim Markovtsev
2015-10-31 20:23:13 +03:00
parent fa8a282696
commit e6e975e9ef
3 changed files with 24 additions and 23 deletions

View File

@ -674,8 +674,8 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
}
else
{
cur->setType(ran.first, ran.second);
}
cur->setType(ran.first, ran.second);
}
}
int CGameState::getDate(Date::EDateType mode) const
@ -2899,11 +2899,11 @@ bool CGPathNode::reachable() const
return turns < 255;
}
const CGPathNode * CPathsInfo::getPathInfo( int3 tile ) const
const CGPathNode * CPathsInfo::getPathInfo( const int3& tile ) const
{
boost::unique_lock<boost::mutex> pathLock(pathMx);
if (tile.x >= sizes.x || tile.y >= sizes.y || tile.z >= sizes.z)
if (tile.x >= sizes.x || tile.y >= sizes.y || tile.z >= sizes.z ||
tile.x < 0 || tile.y < 0 || tile.z < 0)
return nullptr;
return &nodes[tile.x][tile.y][tile.z];
}