From af07333c78199d08659df9f556f09b06efc36d53 Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 26 May 2009 11:57:52 +0000 Subject: (svn r16430) -Fix: crash when a company is deleted while a dropdown with company names is open --- src/toolbar_gui.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 871ef6907..d97059d07 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -167,6 +167,10 @@ public: void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const { CompanyID company = (CompanyID)result; + + /* It's possible the company is deleted while the dropdown is open */ + if (!Company::IsValidID(company)) return; + DrawCompanyIcon(company, left + 2, top + 1); SetDParam(0, company); -- cgit v1.2.3-54-g00ecf