diff src/toolbar_gui.cpp @ 12023:3c4566c47b2f draft

(svn r16430) -Fix: crash when a company is deleted while a dropdown with company names is open
author smatz <smatz@openttd.org>
date Tue, 26 May 2009 11:57:52 +0000
parents e17a54c88806
children 7f4295a66bff
line wrap: on
line diff
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -167,6 +167,10 @@
 	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);