Commit 0280477b authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Proper fix for range check in arrays

parent bdbad150
......@@ -1651,13 +1651,13 @@ def primary_index(root, context):
if not is_integer(idx_bty):
errors.append(error(root, 'Index is not an integer'))
if float(idx_bty.Max) > float(r_max):
if float(idx_bty.Max) >= float(r_max):
'Index range [{id1} .. {id2}] '
'outside of range [{r1} .. {r2}]'
.format(id1=idx_bty.Min, id2=idx_bty.Max,
r1=int(r_min) + 1,
r2=int(r_max) + 1)))
r1=max(0, int(r_min) - 1),
r2=int(r_max) - 1)))
elif float(idx_bty.Min) > float(r_min):
'Index higher than range min value'))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment