From 8d141ca57fc466c6bcda2e8c7ae268b22b63ae0c Mon Sep 17 00:00:00 2001 From: pavanvo Date: Tue, 6 Sep 2022 03:08:28 +0400 Subject: [PATCH] fix: add check --- source/glest_game/network/network_types.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/glest_game/network/network_types.cpp b/source/glest_game/network/network_types.cpp index db2c4ac4..3ba5f508 100644 --- a/source/glest_game/network/network_types.cpp +++ b/source/glest_game/network/network_types.cpp @@ -59,7 +59,8 @@ NetworkCommand::NetworkCommand(World *world, int networkCommandType, int unitId, const CommandType *ct= unit->getType()->findCommandTypeById(this->commandTypeId); if(unitTypeId > -1) { const UnitType *unitType= world->findUnitTypeById(unit->getFaction()->getType(), this->unitTypeId); - ct= unitType->findCommandTypeById(this->commandTypeId); + auto mct= unitType->findCommandTypeById(this->commandTypeId); + if(mct) ct= mct; } if(ct != NULL && ct->getClass() == ccBuild) { @@ -83,7 +84,8 @@ void NetworkCommand::preprocessNetworkCommand(World *world) { const CommandType *ct= unit->getType()->findCommandTypeById(commandTypeId); if(unitTypeId > -1) { const UnitType *unitType= world->findUnitTypeById(unit->getFaction()->getType(), unitTypeId); - ct= unitType->findCommandTypeById(this->commandTypeId); + auto mct= unitType->findCommandTypeById(this->commandTypeId); + if(mct) ct= mct; } if(ct != NULL && ct->getClass() == ccBuild && targetId >= 0) {