Changeset - r20992:d53678a53ceb
[Not reviewed]
master
0 1 0
rubidium - 11 years ago 2013-11-23 18:07:11
rubidium@openttd.org
(svn r26066) -Fix: possible NULL dereference when resolving industry scope
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_industries.cpp
Show inline comments
 
@@ -447,13 +447,15 @@ TownScopeResolver *IndustriesResolverObj
 
{
 
	if (this->town_scope == NULL) {
 
		Town *t = NULL;
 
		bool readonly = true;
 
		if (this->industries_scope.industry != NULL) {
 
			t = this->industries_scope.industry->town;
 
			readonly = this->industries_scope.industry->index == INVALID_INDUSTRY;
 
		} else if (this->industries_scope.tile != INVALID_TILE) {
 
			t = ClosestTownFromTile(this->industries_scope.tile, UINT_MAX);
 
		}
 
		if (t == NULL) return NULL;
 
		this->town_scope = new TownScopeResolver(this, t, this->industries_scope.industry->index == INVALID_INDUSTRY);
 
		this->town_scope = new TownScopeResolver(this, t, readonly);
 
	}
 
	return this->town_scope;
 
}
0 comments (0 inline, 0 general)