summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2020-05-10 19:40:51 +0200
committerCharles Pigott <charlespigott@googlemail.com>2020-05-10 20:03:41 +0100
commit5aa6351042fb1caa787ad3305d56b6712169d330 (patch)
treefccfe609ab29a843b7da2d35a94e1477d2c2d27f
parent0ed00ae1113f71b6bb34a67c013e96e69929e023 (diff)
downloadopenttd-5aa6351042fb1caa787ad3305d56b6712169d330.tar.xz
Fix #8132: Corrupted savegame crashing OpenTTD on load
-rw-r--r--src/saveload/afterload.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index b81d446e4..14d5e5434 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -898,6 +898,9 @@ bool AfterLoadGame()
case MP_STATION: {
BaseStation *bst = BaseStation::GetByTile(t);
+ /* Sanity check */
+ if (bst->owner != GetTileOwner(t)) SlErrorCorrupt("Wrong owner for station tile");
+
/* Set up station spread */
bst->rect.BeforeAddTile(t, StationRect::ADD_FORCE);