Don't use the target list if the world is NULL

This commit is contained in:
smallmodel committed 2025-01-15 18:29:35 +01:00
1 parent 3f9bed938e
commit 2dbe61789d
1 file changed
+7 -1
+7 -1
View File
@@ -1769,7 +1769,13 @@ void ScriptVM::Execute(ScriptVariable *data, int dataSize, str label)
case OP_UN_TARGETNAME:
// retrieve the target name
targetList = world->GetExistingTargetList(m_VMStack.GetTop().stringValue());
if (world) {
targetList = world->GetExistingTargetList(m_VMStack.GetTop().stringValue());
} else {
// Added in OPM
// don't use the target list if the world is NULL
targetList = NULL;
}
if (!targetList || !targetList->list.NumObjects()) {
str targetname = m_VMStack.GetTop().stringValue();