From 18cf896eb7f08f0a229671970a69c4d3f75f9b50 Mon Sep 17 00:00:00 2001 From: Per Inge Mathisen Date: Tue, 19 Oct 2010 20:23:04 +0200 Subject: [PATCH] Check if a structure has a sensor before reading info from it. Fixes crash in threat map code when dealing with lassats. (Of course lassats do things differently than everything else.) Bug found by Cyp. --- src/map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map.c b/src/map.c index 428f63065..65d753e93 100644 --- a/src/map.c +++ b/src/map.c @@ -2255,7 +2255,7 @@ static void threatUpdate(int player) { mode |= asWeaponStats[psStruct->asWeaps[weapon].nStat].surfaceToAir; } - if (psStruct->pStructureType->pSensor->location == LOC_TURRET) // special treatment for sensor turrets + if (psStruct->pStructureType->pSensor && psStruct->pStructureType->pSensor->location == LOC_TURRET) // special treatment for sensor turrets { mode |= SHOOT_ON_GROUND; // assume it only shoots at ground targets for now }