Fix crash on creating map with invalid mg_name
authorkwolekr <kwolekr@minetest.net>
Sun, 7 Apr 2013 05:50:20 +0000 (01:50 -0400)
committerkwolekr <kwolekr@minetest.net>
Sun, 7 Apr 2013 05:50:20 +0000 (01:50 -0400)
src/emerge.cpp

index 2a5e84f67c8ca1d9a9fc2933083c03d6f0c96690..499aaf291916d962818f1bccd50967e0d957d33b 100644 (file)
@@ -243,6 +243,8 @@ MapgenParams *EmergeManager::createMapgenParams(std::string mgname) {
 MapgenParams *EmergeManager::getParamsFromSettings(Settings *settings) {
        std::string mg_name = settings->get("mg_name");
        MapgenParams *mgparams = createMapgenParams(mg_name);
+       if (!mgparams)
+               return NULL;
        
        mgparams->mg_name     = mg_name;
        mgparams->seed        = settings->getU64(settings == g_settings ? "fixed_map_seed" : "seed");