On Fri, 4 Sep 2026 16:36:25 GMT, Andy Goryachev <[email protected]> wrote:

>> Philemon Hilscher has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8222454: Review fixes
>>   
>>   Signed-off-by: Philemon Hilscher <[email protected]>
>
> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/CellBehaviorBase.java
>  line 213:
> 
>> 211: 
>> 212:         int count = getItemCount();
>> 213:         if (cell.getIndex() >= count) {
> 
> is it possible to get a negative index at this point?
> should we check for `index < 0` as well?

Should not be possible. Cells with `-1` index should never be visible, never 
even be rendered. 
`index > itemCount,` on the other hand, is possible, because if you have, let's 
say 5 items and enough space to show 10, then you have 5 empty cells where the 
index is higher than the item count.
And you can click them, e.g. if you register a mouse `EventHandler`, it will 
run.

With that said, a check for `-1` probably wouldn't hurt, but I don't think it's 
really necessary.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2129#discussion_r3945663906

Reply via email to