summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/disaster_cmd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 2db744fb5..725cd914c 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -481,6 +481,12 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
return;
}
+ if (!IsValidTile(v->dest_tile)) {
+ /* Make sure we don't land outside the map. */
+ delete v;
+ return;
+ }
+
byte z = GetSlopeZ(v->x_pos, v->y_pos);
if (z < v->z_pos) {
SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos - 1);