diff --git a/doc/4.1-configuration-syntax.md b/doc/4.1-configuration-syntax.md
index c644edb9e..cbdf913c7 100644
--- a/doc/4.1-configuration-syntax.md
+++ b/doc/4.1-configuration-syntax.md
@@ -223,65 +223,67 @@ In this example a has the value 7 after both instructions are executed.
#### Operator +=
-Modifies a dictionary or array by adding new elements to it.
-
-Example:
+The += operator is a shortcut. The following expression:
{
a = [ "hello" ],
a += [ "world" ]
}
-In this example a contains both `"hello"` and `"world"`. This currently
-only works for dictionaries and arrays.
+is equivalent to:
-
+ {
+ a = 300,
+ a = a / 5
+ }
### Indexer
diff --git a/lib/config/aexpression.cpp b/lib/config/aexpression.cpp
index 133c4ab94..5e8add22c 100644
--- a/lib/config/aexpression.cpp
+++ b/lib/config/aexpression.cpp
@@ -397,5 +397,9 @@ Value AExpression::OpSetDivide(const AExpression *expr, const Dictionary::Ptr& l
Value AExpression::OpIndexer(const AExpression *expr, const Dictionary::Ptr& locals)
{
Dictionary::Ptr dict = locals->Get(expr->m_Operand1);
+
+ if (!dict)
+ BOOST_THROW_EXCEPTION(ConfigError("Script variable '" + expr->m_Operand1 + "' not set in this scope."));
+
return dict->Get(expr->m_Operand2);
}
diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy
index c3e88d125..68bc238bd 100644
--- a/lib/config/config_parser.yy
+++ b/lib/config/config_parser.yy
@@ -547,9 +547,6 @@ lterm_items_inner: /* empty */
lterm: identifier lbinary_op rterm
{
AExpression::Ptr aexpr = static_cast(*$3);
- if ($2 == &AExpression::OpSetPlus || $2 == &AExpression::OpSetMinus || $2 == &AExpression::OpSetMultiply || $2 == &AExpression::OpSetDivide)
- aexpr->MakeInline();
-
$$ = new Value(make_shared($2, $1, aexpr, DebugInfoRange(@1, @3)));
free($1);
delete $3;
@@ -564,9 +561,6 @@ lterm: identifier lbinary_op rterm
subexprl->Add(subexpr);
AExpression::Ptr expr = make_shared(&AExpression::OpDict, subexprl, DebugInfoRange(@1, @6));
- if ($5 == &AExpression::OpSetPlus || $5 == &AExpression::OpSetMinus || $5 == &AExpression::OpSetMultiply || $5 == &AExpression::OpSetDivide)
- expr->MakeInline();
-
$$ = new Value(make_shared(&AExpression::OpSetPlus, $1, expr, DebugInfoRange(@1, @6)));
free($1);
}