Changeset - r26231:81f1d2fdfbbb
[Not reviewed]
master
0 1 0
Andrew Zhou - 3 years ago 2021-12-02 02:17:24
andzhou@umich.edu
Fix: Prevents crash when no industries are present
1 file changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/industry_gui.cpp
Show inline comments
 
@@ -498,8 +498,12 @@ public:
 
					/* We've chosen many random industries but no industries have been specified */
 
					SetDParam(0, STR_FUND_INDUSTRY_BUILD_NEW_INDUSTRY);
 
				} else {
 
					const IndustrySpec *indsp = GetIndustrySpec(this->index[this->selected_index]);
 
					SetDParam(0, (_settings_game.construction.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_FUND_INDUSTRY_PROSPECT_NEW_INDUSTRY : STR_FUND_INDUSTRY_FUND_NEW_INDUSTRY);
 
					if (count > 0) {
 
						const IndustrySpec *indsp = GetIndustrySpec(this->index[this->selected_index]);
 
						SetDParam(0, (_settings_game.construction.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_FUND_INDUSTRY_PROSPECT_NEW_INDUSTRY : STR_FUND_INDUSTRY_FUND_NEW_INDUSTRY);
 
					} else {
 
						SetDParam(0, STR_FUND_INDUSTRY_FUND_NEW_INDUSTRY);
 
					}
 
				}
 
				break;
 
		}
 
@@ -730,6 +734,7 @@ public:
 
	void OnHundredthTick() override
 
	{
 
		if (_game_mode == GM_EDITOR) return;
 
		if (this->count == 0) return;
 
		const IndustrySpec *indsp = GetIndustrySpec(this->selected_type);
 

	
 
		if (indsp->enabled) {
0 comments (0 inline, 0 general)