1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-15 14:26:35 +00:00

Check length before dereferencing

This commit is contained in:
Evil Eye 2025-08-26 18:08:38 +02:00
parent 79a1f1c3d2
commit e88e60f475

View file

@ -196,7 +196,7 @@ namespace LuaUtil
throw std::runtime_error(std::format("No flags found in: {}", line));
std::string_view tagsStr = line.substr(0, semicolonPos);
std::string_view scriptPath = line.substr(semicolonPos + 1);
while (isSpace(scriptPath[0]))
while (!scriptPath.empty() && isSpace(scriptPath[0]))
scriptPath = scriptPath.substr(1);
ESM::LuaScriptCfg& script = cfg.mScripts.emplace_back();