Skip to content

Commit

Permalink
Fixed issue 958
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Feb 15, 2024
1 parent 66a006b commit 2d41d7d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/GCodes/GCodeBuffer/ExpressionParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,11 @@ void ExpressionParser::GetVariableValue(ExpressionValue& rslt, const VariableSet
ReadLocker lock(Heap::heapLock); // must have a read lock on heapLock when calling GetNumElements or GetElement
if (!val.ahVal.GetElement(index, elem))
{
if (context.WantExists())
{
rslt.SetBool(false);
return;
}
ThrowParseException("Index out of range");
}
}
Expand All @@ -1933,7 +1938,14 @@ void ExpressionParser::GetVariableValue(ExpressionValue& rslt, const VariableSet
if (*pos == 0)
{
// End of the expression
rslt = elem;
if (context.WantExists())
{
rslt.SetBool(true);
}
else
{
rslt = elem;
}
return;
}
if (*pos == '^')
Expand Down

0 comments on commit 2d41d7d

Please sign in to comment.