On Thu, 2 Dec 2021 21:51:59 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> Michael Strauß has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Handle division by zero
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/ScrollPaneSkin.java
>  line 895:
> 
>> 893:                 double vRange = 
>> getSkinnable().getVmax()-getSkinnable().getVmin();
>> 894:                 double vPixelValue = vRange / (nodeHeight - 
>> contentHeight);
>> 895:                 vPixelValue = Double.isFinite(vPixelValue) ? 
>> vPixelValue : 0.0;
> 
> I liked the previous logic better and would have just changed the comparison 
> to check `(nodeHeight - contentHeight) > 0.0` (possibly saving the adjusted 
> width or height in a local various to avoid doing it twice). As it is, this 
> is replacing an explicit check on the source values with an out of range 
> check on the result, which seems less intuitive. Also, the previous code did 
> a `> 0` test and the new code effectively does a `!= 0` test.

I changed it to check the denominator values instead.

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

PR: https://git.openjdk.java.net/jfx/pull/660

Reply via email to