Skip to content

Commit

Permalink
getCellIfPresent parameter check (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jugen authored May 25, 2021
1 parent 164e3d0 commit cfc3f62
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/fxmisc/flowless/CellListManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public C getPresentCell(int itemIndex) {
}

public Optional<C> getCellIfPresent(int itemIndex) {
if (itemIndex>=cells.size()||itemIndex<0) {
return Optional.empty();
}
return cells.getIfMemoized(itemIndex); // getIfMemoized() may throw
}

Expand Down

0 comments on commit cfc3f62

Please sign in to comment.