Fixed crash in DynOS_Lvl_Activate()

This commit is contained in:
David Joslin 2023-11-08 12:54:54 -08:00 committed by Agent X
parent 9b23b7dab4
commit 5a5f33d859
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
auto& newScripts = _Node->mLevelScripts;
if (newScripts.Count() <= 0) {
PrintError("Could not find level scripts: '%s'", aLevelName);
return;
}
auto& newScriptNode = newScripts[newScripts.Count() - 1];
const void* originalScript = DynOS_Builtin_ScriptPtr_GetFromName(newScriptNode->mName.begin());
if (originalScript == NULL) {