fix(lua): Fix crash when trying to reload a non-existent script. (#2151) (#2162)

This commit is contained in:
Quentin 2023-09-20 14:51:23 +02:00 committed by GitHub
parent 5a2dfb90b6
commit 1817ee9fda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<const char*>(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();