Skip to content

Commit

Permalink
Fix: Dict initializer incorrectly re-initialized field that is set to…
Browse files Browse the repository at this point in the history
… an empty string

fixes #9835
  • Loading branch information
gunnarbeutner committed Aug 24, 2015
1 parent e9c2214 commit f732ec3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/config/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,12 @@ bool IndexerExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *
psdhint = *dhint;

if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, &psdhint)) {
if (init_dict && VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo()).IsEmpty())
VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo());
if (init_dict) {
Value old_value = VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo());

if (old_value.IsEmpty() && !old_value.IsString())
VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo());
}

*parent = VMOps::GetField(vparent, vindex, m_DebugInfo);
free_psd = true;
Expand Down

0 comments on commit f732ec3

Please sign in to comment.