Skip to content

Commit

Permalink
Merge pull request #148 from mkoura/zero_indexed_table_fix
Browse files Browse the repository at this point in the history
[RFR] Fixes zero-indexed table bounds checking
  • Loading branch information
mshriver authored Apr 26, 2019
2 parents 4564f3d + 9145764 commit 4764f40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/widgetastic/widget/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,9 @@ def __getitem__(self, item):
at_index = row.index
elif isinstance(item, int):
at_index = item
if at_index > self.row_count:
raise IndexError('Integer row index {} is greater than row count {}'
.format(at_index, self.row_count))
if at_index >= self.row_count:
raise IndexError('Integer row index {} is greater than max index {}'
.format(at_index, self.row_count - 1))
else:
raise TypeError('Table [] accepts only strings or integers.')
if at_index < 0:
Expand Down

0 comments on commit 4764f40

Please sign in to comment.