summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/station.cpp')
-rw-r--r--src/station.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/station.cpp b/src/station.cpp
index b8946aeb4..57c9f150f 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -101,6 +101,12 @@ Station::~Station()
for (CargoID c = 0; c < NUM_CARGO; c++) {
goods[c].cargo.Truncate(0);
}
+
+ CargoPacket *cp;
+ FOR_ALL_CARGOPACKETS(cp) {
+ /* Don't allow cargo packets with invalid source station */
+ if (cp->source == this->index) cp->source = INVALID_STATION;
+ }
}