diff --git a/src/structure.c b/src/structure.c index a418cf2ee..bdfc385b2 100644 --- a/src/structure.c +++ b/src/structure.c @@ -6780,9 +6780,17 @@ void hqReward(UBYTE losingPlayer, UBYTE rewardPlayer) // BOOL StructIsFactory(STRUCTURE *Struct) { - return Struct->pStructureType->type == REF_FACTORY || - Struct->pStructureType->type == REF_CYBORG_FACTORY || - Struct->pStructureType->type == REF_VTOL_FACTORY; + ASSERT_OR_RETURN(false, Struct != NULL, "Invalid structure!"); + ASSERT_OR_RETURN(false, Struct->pStructureType != NULL, "Invalid structureType!"); + + if( (Struct->pStructureType->type == REF_FACTORY) || + (Struct->pStructureType->type == REF_CYBORG_FACTORY) || + (Struct->pStructureType->type == REF_VTOL_FACTORY) ) + { + return true; + } + + return false; }