summaryrefslogtreecommitdiffstats
path: root/src/control/Script4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/Script4.cpp')
-rw-r--r--src/control/Script4.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index d5edc5cf..7ff785d5 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -2262,8 +2262,10 @@ void CTheScripts::SwapNearestBuildingModel(float x, float y, float z, float radi
}
}
CBuilding* pReplacedBuilding = ((CBuilding*)pClosestEntity);
- pReplacedBuilding->ReplaceWithNewModel(mi2);
- AddToBuildingSwapArray(pReplacedBuilding, mi1, mi2);
+ if (pReplacedBuilding) {
+ pReplacedBuilding->ReplaceWithNewModel(mi2);
+ AddToBuildingSwapArray(pReplacedBuilding, mi1, mi2);
+ }
}
void CTheScripts::AddToBuildingSwapArray(CBuilding* pBuilding, int32 old_model, int32 new_model)