mirror of
https://github.com/Icinga/icinga2.git
synced 2026-05-28 04:12:13 -04:00
IndexerExpression#GetReference(): ref, not copy, index if it's a literal string
This commit is contained in:
parent
73e2a367ed
commit
d072c6bc22
1 changed files with 8 additions and 2 deletions
|
|
@ -792,8 +792,14 @@ bool IndexerExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *
|
|||
*parent = operand1.GetValue();
|
||||
}
|
||||
|
||||
ExpressionResult operand2 = m_Operand2->Evaluate(frame);
|
||||
index->Set(operand2.GetValue());
|
||||
auto lit (dynamic_cast<LiteralExpression*>(m_Operand2.get()));
|
||||
|
||||
if (lit && lit->GetValue().IsString()) {
|
||||
index->Set(&lit->GetValue().Get<String>());
|
||||
} else {
|
||||
ExpressionResult operand2 = m_Operand2->Evaluate(frame);
|
||||
index->Set(operand2.GetValue());
|
||||
}
|
||||
|
||||
if (dhint) {
|
||||
if (psdhint)
|
||||
|
|
|
|||
Loading…
Reference in a new issue