Fix crash caused by Lua error during startup (#7473)
authorred-001 <red-001@outlook.ie>
Fri, 22 Jun 2018 19:04:41 +0000 (20:04 +0100)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Fri, 22 Jun 2018 19:04:41 +0000 (21:04 +0200)
src/emerge.cpp

index 2778410531245d55182c177916f89c2e20f5de41..592b1bef7c838200eb390cf7c7727bf07d7f7de3 100644 (file)
@@ -169,7 +169,10 @@ EmergeManager::~EmergeManager()
                }
 
                delete thread;
-               delete m_mapgens[i];
+
+               // Mapgen init might not be finished if there is an error during startup.
+               if (m_mapgens.size() > i)
+                       delete m_mapgens[i];
        }
 
        delete biomemgr;