Fix a crash related to corrupt templates. Fixes bug #1012.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8597 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2009-12-02 11:39:56 +00:00 committed by Git SVN Gateway
parent 5ba89a0f93
commit bf366b2527
1 changed files with 4 additions and 4 deletions

View File

@ -6177,8 +6177,8 @@ BOOL validTemplateForFactory(DROID_TEMPLATE *psTemplate, STRUCTURE *psFactory)
}
}
//check for VTOL droid
else if ((asPropulsionStats + psTemplate->asParts[COMP_PROPULSION])->
propulsionType == PROPULSION_TYPE_LIFT)
else if (psTemplate->asParts[COMP_PROPULSION] &&
((asPropulsionStats + psTemplate->asParts[COMP_PROPULSION])->propulsionType == PROPULSION_TYPE_LIFT))
{
if (psFactory->pStructureType->type != REF_VTOL_FACTORY)
{
@ -6201,8 +6201,8 @@ BOOL validTemplateForFactory(DROID_TEMPLATE *psTemplate, STRUCTURE *psFactory)
//check if vtol factory
else if (psFactory->pStructureType->type == REF_VTOL_FACTORY)
{
if ((asPropulsionStats + psTemplate->asParts[COMP_PROPULSION])->
propulsionType != PROPULSION_TYPE_LIFT)
if (!psTemplate->asParts[COMP_PROPULSION] ||
((asPropulsionStats + psTemplate->asParts[COMP_PROPULSION])->propulsionType != PROPULSION_TYPE_LIFT))
{
return false;
}