1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00

Safety checks

This commit is contained in:
nordsoft 2022-09-07 02:39:28 +04:00
parent dc65d1c2b6
commit b284652f71

View File

@ -46,7 +46,7 @@ PlayerParams::PlayerParams(MapController & ctrl, int playerId, QWidget *parent)
for(int i = 0; i < controller.map()->towns.size(); ++i)
{
auto town = controller.map()->towns[i];
if(town->getOwner().getNum() == playerColor)
if(town && town->town && town->town->faction && town->getOwner().getNum() == playerColor)
{
if(playerInfo.hasMainTown && playerInfo.posOfMainTown == town->pos)
foundMainTown = i;