On Sun, 12 Apr 2026 18:37:45 GMT, Marius Hanl <[email protected]> wrote:

>> Charlie Schlosser has updated the pull request incrementally with two 
>> additional commits since the last revision:
>> 
>>  - copyright
>>  - its not necessary
>
> modules/javafx.controls/src/main/java/javafx/scene/control/TreeView.java line 
> 1074:
> 
>> 1072: 
>> 1073:         // Iterator is exhausted before reaching _row. Should not 
>> happen in normal use.
>> 1074:         return TreeUtil.getItem(getRoot(), _row, 
>> expandedItemCountDirty);
> 
> Do we need this call still? 
> Can't we just return null? Especially wondering, because if this method is 
> called with an invalid row index, we will go through the whole iterator

The nonsense invalid index is guarded at the top by `if (row < 0) return null;`

`_row <= treeItemIteratorRow` guards against the scenario where the cached 
`SoftReference` is cleared. If all those guards fail and we still manage to 
exhaust the iterator, then I suppose `TreeUtil.getItem` probably won't help 
either. 

Probably better to just return null at that point!

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2142#discussion_r3070371637

Reply via email to