changeset 16092:9e2d9845b808 draft

(svn r20785) -Fix: crash when closing the station view of oilrigs (similar to r20774)
author rubidium <rubidium@openttd.org>
date Sat, 11 Sep 2010 17:45:03 +0000
parents a9945a283858
children 93e526b9c167
files src/station_gui.cpp
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -905,6 +905,8 @@
 	~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);