Make sure pointer is valid before using it.

refs ticket:2171

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/branches/2.3@11698 4a71c877-e1ca-e34f-864e-861f7616d084
(cherry picked from commit 4853171df29c2d8286b5b3a84038189d18bac308)

Conflicts:

	src/structure.c
master
buginator 2010-10-18 22:11:16 -04:00
parent ec18ac9365
commit 5f83b41456
1 changed files with 11 additions and 3 deletions

View File

@ -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;
}