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

This commit is contained in:
smallmodel 2025-01-15 18:29:35 +01:00
parent 3f9bed938e
commit 2dbe61789d
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

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();