Fix issues in index-of expression (#1121)
Co-authored-by: Ovidiu Voda <ovi.voda@gmail.com> Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
committed by
GitHub
parent
1ec5f44924
commit
5990efbb12
@@ -41,7 +41,7 @@ EvaluationResult IndexOf::evaluate(const EvaluationContext ¶ms) const {
|
||||
return EvaluationError{"Expected third argument to be of type number, but found " +
|
||||
toString(typeOf(*evaluatedFromIndex)) + " instead."};
|
||||
}
|
||||
fromIndexValue = static_cast<size_t>(evaluatedFromIndex->get<double>());
|
||||
fromIndexValue = static_cast<size_t>(std::max(evaluatedFromIndex->get<double>(), 0.0));
|
||||
}
|
||||
|
||||
return evaluatedInput->match(
|
||||
|
||||
Reference in New Issue
Block a user