mapgen: Fix segfault when selecting invalid mapgen (#5491)

master
SmallJoker 2017-04-01 10:18:13 +02:00 committed by Loïc Blot
parent a4874270f7
commit 773efc19b1
1 changed files with 5 additions and 2 deletions

View File

@ -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);