summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/saveload/afterload.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 5948415a6..4c561d8de 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2377,6 +2377,10 @@ bool AfterLoadGame()
* get messed up just after loading the savegame. This fixes that. */
Vehicle *v;
FOR_ALL_VEHICLES(v) {
+ /* Not all vehicle types can be inside a tunnel. Furthermore,
+ * testing IsTunnelTile() for invalid tiles causes a crash. */
+ if (!v->IsGroundVehicle()) continue;
+
/* Is the vehicle in a tunnel? */
if (!IsTunnelTile(v->tile)) continue;