Skip to content

Commit

Permalink
DefaultHistory: check index range before getting record, fixes #450
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Oct 18, 2019
1 parent 6cc5943 commit 6116228
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ private String format(Entry entry) {
}

public String get(final int index) {
return items.get(index - offset).line();
int idx = index - offset;
if (idx >= items.size() || idx < 0) {
throw new IllegalArgumentException("IndexOutOfBounds: Index:" + idx +", Size:" + items.size());
}
return items.get(idx).line();
}

@Override
Expand Down

0 comments on commit 6116228

Please sign in to comment.