fix(fgame): only throw an error if the target name is not found when g_scriptdebug is set

This commit is contained in:
smallmodel committed 2026-03-06 00:57:52 +01:00
1 parent 87dd1f650e
commit ab43a0def6
1 file changed
+5 -4
+5 -4
View File
@@ -1802,13 +1802,14 @@ void ScriptVM::Execute(ScriptVariable *data, int dataSize, str label)
}
if (!targetList || !targetList->list.NumObjects()) {
str targetname = m_VMStack.GetTop().stringValue();
// the target name was not found
m_VMStack.GetTop().setListenerValue(NULL);
if ((*m_PrevCodePos >= OP_BIN_EQUALITY && *m_PrevCodePos <= OP_BIN_GREATER_THAN_OR_EQUAL)
|| (*m_PrevCodePos >= OP_BOOL_UN_NOT && *m_PrevCodePos <= OP_UN_CAST_BOOLEAN)) {
if (g_scriptdebug->integer) {
const str targetname = m_VMStack.GetTop().stringValue();
m_VMStack.GetTop().setListenerValue(NULL);
ScriptError("Targetname '%s' does not exist.", targetname.c_str());
} else {
m_VMStack.GetTop().setListenerValue(NULL);
}
} else if (targetList->list.NumObjects() == 1) {
// single listener