Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mapgen: Fix segfault when selecting invalid mapgen (#5491)
  • Loading branch information
SmallJoker authored and nerzhul committed Apr 1, 2017
1 parent a487427 commit 773efc1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/mapgen.cpp
Expand Up @@ -1003,8 +1003,11 @@ void MapgenParams::readParams(const Settings *settings)
}

std::string mg_name;
if (settings->getNoEx("mg_name", mg_name))
this->mgtype = Mapgen::getMapgenType(mg_name);
if (settings->getNoEx("mg_name", mg_name)) {
mgtype = Mapgen::getMapgenType(mg_name);
if (mgtype == MAPGEN_INVALID)
mgtype = MAPGEN_DEFAULT;
}

settings->getS16NoEx("water_level", water_level);
settings->getS16NoEx("mapgen_limit", mapgen_limit);
Expand Down

0 comments on commit 773efc1

Please sign in to comment.