summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-09-11 17:45:03 +0000
committerrubidium <rubidium@openttd.org>2010-09-11 17:45:03 +0000
commite63d975d6e81e67110dce31549957f4dcc2b13e8 (patch)
tree8eece52c368604f1dddda6e6fac28644d0e428f8 /src
parentdfeac6ba2eb99e0b33d756210c052c306756753d (diff)
downloadopenttd-e63d975d6e81e67110dce31549957f4dcc2b13e8.tar.xz
(svn r20785) -Fix: crash when closing the station view of oilrigs (similar to r20774)
Diffstat (limited to 'src')
-rw-r--r--src/station_gui.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 37ff622d3..c3d3d87fe 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -905,6 +905,8 @@ struct StationViewWindow : public Window {
~StationViewWindow()
{
Owner owner = Station::Get(this->window_number)->owner;
+ if (!Company::IsValidID(owner)) owner = _local_company;
+ if (!Company::IsValidID(owner)) return; // Spectators
DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, owner, this->window_number).Pack(), false);
DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, owner, this->window_number).Pack(), false);
DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, owner, this->window_number).Pack(), false);