Fixed crash in DynOS_Lvl_Activate()

This commit is contained in:
MysterD 2023-11-08 12:54:54 -08:00
parent 7867949c0e
commit 37b6df7f5a
1 changed files with 5 additions and 0 deletions

View File

@ -84,6 +84,11 @@ void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLev
// Override vanilla script // Override vanilla script
auto& newScripts = _Node->mLevelScripts; auto& newScripts = _Node->mLevelScripts;
if (newScripts.Count() <= 0) {
PrintError("Could not find level scripts: '%s'", aLevelName);
return;
}
auto& newScriptNode = newScripts[newScripts.Count() - 1]; auto& newScriptNode = newScripts[newScripts.Count() - 1];
const void* originalScript = DynOS_Builtin_ScriptPtr_GetFromName(newScriptNode->mName.begin()); const void* originalScript = DynOS_Builtin_ScriptPtr_GetFromName(newScriptNode->mName.begin());
if (originalScript == NULL) { if (originalScript == NULL) {