summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/train_cmd.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 4c7bf90cf..2c300c190 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -839,6 +839,7 @@ static Vehicle *UnlinkWagon(Vehicle *v, Vehicle *first)
Vehicle *u;
for (u = first; GetNextVehicle(u) != v; u = GetNextVehicle(u)) {}
GetLastEnginePart(u)->next = GetNextVehicle(v);
+ v->first = NULL; // we shouldn't point to the old first, since the vehicle isn't in that chain anymore
return first;
}