mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-06 14:10:36 +00:00
8263362: Avoid division by 0 in java/awt/font/TextJustifier.java justify
Reviewed-by: psadhukhan
This commit is contained in:
parent
0f9852c63b
commit
ea30bd6684
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -155,10 +155,13 @@ class TextJustifier {
|
||||
boolean absorbing = hitLimit && absorbweight > 0;
|
||||
|
||||
// predivide delta by weight
|
||||
float weightedDelta = delta / weight; // not used if weight == 0
|
||||
float weightedDelta = 0;
|
||||
if (weight != 0) { // not used if weight == 0
|
||||
weightedDelta = delta / weight;
|
||||
}
|
||||
|
||||
float weightedAbsorb = 0;
|
||||
if (hitLimit && absorbweight > 0) {
|
||||
if (hitLimit && absorbweight != 0) {
|
||||
weightedAbsorb = (delta - gslimit) / absorbweight;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user