From 67c1c52caa41c5cd0af8811763196cd45204494e Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 11 Oct 2010 15:58:10 +0000 Subject: [PATCH] - added an extra NULL check to new max unit check --- source/glest_game/type_instances/faction.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index e3984f0ec..7e2914078 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -173,16 +173,16 @@ bool Faction::reqsOk(const RequirableType *rt) const{ } //required upgrades - for(int i=0; igetUpgradeReqCount(); ++i){ - if(!upgradeManager.isUpgraded(rt->getUpgradeReq(i))){ + for(int i=0; igetUpgradeReqCount(); ++i) { + if(upgradeManager.isUpgraded(rt->getUpgradeReq(i)) == false) { return false; } } - if(dynamic_cast(rt) != NULL ){ + if(dynamic_cast(rt) != NULL ) { const UnitType *producedUnitType=(UnitType *) rt; - if(producedUnitType->getMaxUnitCount()>0){ - if(producedUnitType->getMaxUnitCount()<=getCountForMaxUnitCount(producedUnitType)){ + if(producedUnitType != NULL && producedUnitType->getMaxUnitCount() > 0) { + if(producedUnitType->getMaxUnitCount() <= getCountForMaxUnitCount(producedUnitType)) { return false; } }