fix(script): retrieve type name before clearing and printing valid type in array evaluation

This commit is contained in:
smallmodel committed 2026-01-17 22:10:07 +01:00
1 parent 098843cd0a
commit 3cda08bec4
1 file changed
+4 -1
+4 -1
View File
@@ -957,6 +957,7 @@ void ScriptVariable::evalArrayAt(ScriptVariable& var)
unsigned int index;
str string;
ScriptVariable *array;
const char *typeName;
switch (GetType()) {
case VARIABLE_VECTOR:
@@ -1036,8 +1037,10 @@ void ScriptVariable::evalArrayAt(ScriptVariable& var)
break;
default:
typeName = GetTypeName();
Clear();
throw ScriptException("[] applied to invalid type '%s'", GetTypeName());
throw ScriptException("[] applied to invalid type '%s'", typeName);
break;
}
}