summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-26 11:57:52 +0000
committersmatz <smatz@openttd.org>2009-05-26 11:57:52 +0000
commitaf07333c78199d08659df9f556f09b06efc36d53 (patch)
tree949f9613a2618d953d7b5b2ce62364b37fd43cd3 /src
parenta10e5f707a4dd893b5cf80faa189f669291a4906 (diff)
downloadopenttd-af07333c78199d08659df9f556f09b06efc36d53.tar.xz
(svn r16430) -Fix: crash when a company is deleted while a dropdown with company names is open
Diffstat (limited to 'src')
-rw-r--r--src/toolbar_gui.cpp4
1 files changed, 4 insertions, 0 deletions
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);