Skip to content

Commit bbd9101

Browse files
committed
Fix DialogCheck ArithmeticException
Caused by #2457 doing division by zero when button has no text but just image.
1 parent f7dd97b commit bbd9101

File tree

1 file changed

+2
-1
lines changed
  • tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util

1 file changed

+2
-1
lines changed

tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/DialogCheck.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ private static void verifyButtonText(Button button) {
156156
//if (size.y/preferred.y) == X, then label spans X lines, so divide
157157
//the calculated value of preferred.x by X
158158
if (preferred.y * size.y > 0) {
159-
preferred.y /= button.getText().lines().count(); // check for '\n\'
159+
String buttonText = button.getText();
160+
preferred.y /= buttonText.isEmpty() ? 1 : buttonText.lines().count(); // check for '\n\'
160161
if (size.y / preferred.y > 1) {
161162
preferred.x /= (size.y / preferred.y);
162163
}

0 commit comments

Comments
 (0)