Skip to content

Commit

Permalink
Fix DialogCheck ArithmeticException
Browse files Browse the repository at this point in the history
Caused by
#2457 doing
division by zero when button has no text but just image.
  • Loading branch information
akurtakov committed Oct 30, 2024
1 parent f7dd97b commit bbd9101
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ private static void verifyButtonText(Button button) {
//if (size.y/preferred.y) == X, then label spans X lines, so divide
//the calculated value of preferred.x by X
if (preferred.y * size.y > 0) {
preferred.y /= button.getText().lines().count(); // check for '\n\'
String buttonText = button.getText();
preferred.y /= buttonText.isEmpty() ? 1 : buttonText.lines().count(); // check for '\n\'
if (size.y / preferred.y > 1) {
preferred.x /= (size.y / preferred.y);
}
Expand Down

0 comments on commit bbd9101

Please sign in to comment.