From 1f5554c5c7ed7e705a3b605cde4b1980cb2382bf Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 24 Oct 2010 20:59:25 +0000 Subject: [PATCH] (svn r21035) -Fix [FS#4181] (r21020): crash when opening the buoy's viewport. Based on a patch by Krille. --- src/waypoint_gui.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index b05172468e..070e4eea7d 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -46,7 +46,11 @@ private: */ TileIndex GetCenterTile() const { - return this->wp->IsInUse() ? this->wp->train_station.GetCenterTile() : this->wp->xy; + if (!this->wp->IsInUse()) return this->wp->xy; + + TileArea ta; + this->wp->GetTileArea(&ta, this->vt == VEH_TRAIN ? STATION_WAYPOINT : STATION_BUOY); + return ta.GetCenterTile(); } public: