summaryrefslogtreecommitdiff
path: root/industry_gui.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-09-18 06:34:37 +0000
committerpeter1138 <peter1138@openttd.org>2006-09-18 06:34:37 +0000
commit7334d17c410a4cd4bc0d1c2424d1e8d8168aad03 (patch)
tree8b6a1b6129c9d6bd970176941c8a4bae91fbfe79 /industry_gui.c
parentc474ba5fd13355ee26790b2bb27b4158787747d5 (diff)
downloadopenttd-7334d17c410a4cd4bc0d1c2424d1e8d8168aad03.tar.xz
(svn r6475) - Fix (r6055): Don't try to sort industries when there are none. Thanks to 'Delboy'
Diffstat (limited to 'industry_gui.c')
-rw-r--r--industry_gui.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/industry_gui.c b/industry_gui.c
index 4b3a1a2c0..1671098be 100644
--- a/industry_gui.c
+++ b/industry_gui.c
@@ -556,6 +556,9 @@ static void MakeSortedIndustryList(void)
const Industry* i;
int n = 0;
+ /* Don't attempt a sort if there are no industries */
+ if (GetIndustryArraySize() == 0) return;
+
/* Create array for sorting */
_industry_sort = realloc((void *)_industry_sort, GetIndustryArraySize() * sizeof(_industry_sort[0]));
if (_industry_sort == NULL)