From 1817ee9fda1a2bfd1bae8aaa22ee1e114906c4b0 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 20 Sep 2023 14:51:23 +0200 Subject: [PATCH] fix(lua): Fix crash when trying to reload a non-existent script. (#2151) (#2162) --- src/lua/lua_manager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lua/lua_manager.cpp b/src/lua/lua_manager.cpp index 911245d4..d981c83b 100644 --- a/src/lua/lua_manager.cpp +++ b/src/lua/lua_manager.cpp @@ -88,6 +88,12 @@ namespace big void lua_manager::load_module(const std::filesystem::path& module_path) { + if (!std::filesystem::exists(module_path)) + { + LOG(WARNING) << reinterpret_cast(module_path.u8string().c_str()) << " does not exist in the filesystem. Not loading it."; + return; + } + std::lock_guard guard(m_module_lock); const auto module_name = module_path.filename().string();