Fixed crash if puds contain a platform without oil-patch below.

This commit is contained in:
johns 2002-07-21 22:56:05 +00:00
parent b67184cf6e
commit 9badbd20c8

View file

@ -511,12 +511,14 @@ global void PlaceUnit(Unit* unit,int x,int y)
if( type->GivesOil ) {
Unit* temp;
DebugLevel0Fn("Remove oil-patch\n");
temp=OilPatchOnMap(x,y);
DebugCheck( !temp );
unit->Value=temp->Value;
// oil patch should NOT make sound, handled by let unit die
LetUnitDie(temp); // Destroy oil patch
if( (temp=OilPatchOnMap(x,y)) ) {
DebugCheck( !temp );
unit->Value=temp->Value;
// oil patch should NOT make sound, handled by let unit die
LetUnitDie(temp); // Destroy oil patch
} else {
DebugLevel0Fn("No oil-patch to remove.\n");
}
}
}