1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Do not load mod if given init script doesn't exist

This commit is contained in:
ZavGaro 2024-08-20 21:29:52 +03:00
parent 350c391b05
commit ac8de2173a

View file

@ -266,6 +266,11 @@ std::string ScriptApiBase::getCurrentModName(lua_State *L)
void ScriptApiBase::loadMod(const std::string &script_path,
const std::string &mod_name)
{
if (!fs::IsFile(script_path)) {
errorstream << "Mod error: Failed to load mod \"" << mod_name
<< "\" as script \"" << script_path << "\" does not exist" << std::endl;
return;
}
ModNameStorer mod_name_storer(getStack(), mod_name);
loadScript(script_path);