diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2017-04-01 10:18:13 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-04-01 10:18:13 +0200 |
commit | 773efc19b1d05e573d5bc811c0175d192f7c12c5 (patch) | |
tree | 2828d44e4ebc5af4740dbe4658bd637bb0dd23bc | |
parent | a4874270f791fae8745cac23e153c59bef81bd1e (diff) | |
download | minetest-773efc19b1d05e573d5bc811c0175d192f7c12c5.tar.gz minetest-773efc19b1d05e573d5bc811c0175d192f7c12c5.tar.bz2 minetest-773efc19b1d05e573d5bc811c0175d192f7c12c5.zip |
mapgen: Fix segfault when selecting invalid mapgen (#5491)
-rw-r--r-- | src/mapgen.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 6f3ea7cb0..b6e8c0fd1 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -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); |