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)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Thu, 28 Jun 2018 17:11:01 +0000 (19:11 +0200)
src/emerge.cpp

index f7f6ff603832d4f3ee15ba4f9557310e288e7bc8..2f0dc8750d0cf684ba36fbe243a92851d50aeb63 100644 (file)
@@ -146,7 +146,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;