1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-13 11:40:38 +02:00

[editor] fix Player Settings crash when random town is added to a map

fixes #1714
This commit is contained in:
Andrey Filipenkov 2023-03-18 12:08:44 +03:00
parent 3602645a30
commit 8f638e7ca6

View File

@ -59,7 +59,10 @@ PlayerParams::PlayerParams(MapController & ctrl, int playerId, QWidget *parent)
{ {
auto * ctown = town->town; auto * ctown = town->town;
if(!ctown) if(!ctown)
{
ctown = VLC->townh->randomTown; ctown = VLC->townh->randomTown;
town->town = ctown;
}
if(ctown && town->getOwner().getNum() == playerColor) if(ctown && town->getOwner().getNum() == playerColor)
{ {
if(playerInfo.hasMainTown && playerInfo.posOfMainTown == town->pos) if(playerInfo.hasMainTown && playerInfo.posOfMainTown == town->pos)