From 1b85c10a5b2b4f427ec097c45ea7b701340e81df Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 11 Apr 2009 14:54:03 +0000 Subject: (svn r16027) -Fix (r9555): Usage of uninitialised memory when trying to build a random new industry, but there are no industrytypes to choose from (i.e. all appearance probabilities are zero). --- src/industry_cmd.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 88cdf7a09..768584d33 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1872,6 +1872,9 @@ static void MaybeNewIndustry(void) } } + /* Abort if there is no industry buildable */ + if (probability_max == 0) return; + /* Find a random type, with maximum being what has been evaluate above*/ rndtype = RandomRange(probability_max); for (j = 0; j < NUM_INDUSTRYTYPES; j++) { -- cgit v1.2.3-70-g09d2