On Tue, 1 Sep 2026 22:05:13 GMT, Andy Goryachev <[email protected]> wrote:
>> modules/jfx.incubator.richtext/src/main/java/com/sun/jfx/incubator/scene/control/richtext/RangeInfo.java
>> line 101:
>>
>>> 99: if (lines != null) {
>>> 100: int sz = lines.length;
>>> 101: if (y < lines[0]) {
>>
>> You'd need to assert that sz > 0
>
> this is taken care of in L56
Right, but only because the order of calls is like this, but it that changes in
the future, or there is another place that calls directly findHitMidpoint(),
then there is no check in place.
>> modules/jfx.incubator.richtext/src/main/java/com/sun/jfx/incubator/scene/control/richtext/RangeInfo.java
>> line 103:
>>
>>> 101: if (y < lines[0]) {
>>> 102: return midPoint(0, lines[0]);
>>> 103: } else if (y >= lines[sz - 1]) {
>>
>> make sure sz > 1
>
> L56
In this case, sz > 1 is needed, L56 is just sz != 0 (and also, the comment
about the order of calls)
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2280#discussion_r3908934241
PR Review Comment: https://git.openjdk.org/jfx/pull/2280#discussion_r3908933558