From b5f4cec7254de6ab20f15ffa4e30bbfad038d2e7 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Tue, 8 Aug 2023 23:41:39 +0200 Subject: [PATCH] Fix crash if content file is not found (was caused by !3249) --- apps/openmw/engine.cpp | 7 ++++--- apps/openmw/mwworld/worldimp.cpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index be85feb5d8..02b292adce 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -673,9 +673,6 @@ void OMW::Engine::prepareEngine() mLuaManager = std::make_unique(mVFS.get(), mResDir / "lua_libs"); mEnvironment.setLuaManager(*mLuaManager); - // starts a separate lua thread if "lua num threads" > 0 - mLuaWorker = std::make_unique(*mLuaManager, *mViewer); - // Create input and UI first to set up a bootstrapping environment for // showing a loading screen and keeping the window responsive while doing so @@ -760,6 +757,7 @@ void OMW::Engine::prepareEngine() using namespace std::chrono_literals; while (dataLoading.wait_for(50ms) != std::future_status::ready) asyncListener.update(); + dataLoading.get(); } listener->loadingOff(); @@ -835,6 +833,9 @@ void OMW::Engine::prepareEngine() mLuaManager->init(); mLuaManager->loadPermanentStorage(mCfgMgr.getUserConfigPath()); + + // starts a separate lua thread if "lua num threads" > 0 + mLuaWorker = std::make_unique(*mLuaManager, *mViewer); } // Initialise and enter main loop. diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 7f2260f1a5..3b16727acf 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -584,7 +584,8 @@ namespace MWWorld World::~World() { // Must be cleared before mRendering is destroyed - mProjectileManager->clear(); + if (mProjectileManager) + mProjectileManager->clear(); } void World::setRandomSeed(uint32_t seed)