Fix crash when accessing invalid fields

fixes #8104
This commit is contained in:
Gunnar Beutner 2014-12-18 11:21:11 +01:00
parent 1ff8aaa2bc
commit 28734daa06
2 changed files with 5 additions and 4 deletions

View File

@ -165,7 +165,8 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
try { try {
ScriptFrame frame(dobj); ScriptFrame frame(dobj);
frame.Locals = m_Scope; if (m_Scope)
m_Scope->CopyTo(frame.Locals);
m_Expression->Evaluate(frame, &debugHints); m_Expression->Evaluate(frame, &debugHints);
} catch (const ScriptError& ex) { } catch (const ScriptError& ex) {
ConfigCompilerContext::GetInstance()->AddMessage(true, ex.what(), ex.GetDebugInfo()); ConfigCompilerContext::GetInstance()->AddMessage(true, ex.what(), ex.GetDebugInfo());

View File

@ -122,7 +122,7 @@ bool VariableExpression::GetReference(ScriptFrame& frame, bool init_dict, Value
if (dhint) if (dhint)
*dhint = NULL; *dhint = NULL;
} else } else
*parent = frame.Locals; *parent = frame.Self;
return true; return true;
} }
@ -418,8 +418,8 @@ bool IndexerExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *
String vindex; String vindex;
if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, dhint)) { if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, dhint)) {
if (init_dict && VMOps::GetField(vparent, vindex).IsEmpty()) if (init_dict && VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo()).IsEmpty())
VMOps::SetField(vparent, vindex, new Dictionary()); VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo());
*parent = VMOps::GetField(vparent, vindex, m_DebugInfo); *parent = VMOps::GetField(vparent, vindex, m_DebugInfo);
} else } else