mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-21 19:00:30 +02:00
fix(script): fix array being freed during evaluation (#904)
This commit is contained in:
1 parent
42a9d00bbf
commit
dd1e7469ab
1 file changed
+13
-2
@@ -996,25 +996,36 @@ void ScriptVariable::evalArrayAt(ScriptVariable& var)
|
||||
break;
|
||||
|
||||
case VARIABLE_ARRAY:
|
||||
{
|
||||
ScriptVariable result;
|
||||
|
||||
array = m_data.arrayValue->arrayValue.find(var);
|
||||
|
||||
if (array) {
|
||||
*this = *array;
|
||||
result = *array;
|
||||
*this = result;
|
||||
} else {
|
||||
Clear();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VARIABLE_CONSTARRAY:
|
||||
{
|
||||
ScriptVariable result;
|
||||
|
||||
index = var.intValue();
|
||||
|
||||
if (index == 0 || index > m_data.constArrayValue->size) {
|
||||
throw ScriptException("array index %d out of range", index);
|
||||
}
|
||||
|
||||
*this = m_data.constArrayValue->constArrayValue[index - 1];
|
||||
result = m_data.constArrayValue->constArrayValue[index - 1];
|
||||
*this = result;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VARIABLE_CONTAINER:
|
||||
index = var.intValue();
|
||||
|
||||
Reference in new issue
Block a user