Skip to content

Commit 40bd474

Browse files
committed
SwingNumberWidget: fix non-integer step size bug
When the parameter is new and has a null default value, it would crash. Fixes scijava/scijava-common#434.
1 parent 94e06b5 commit 40bd474

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/scijava/ui/swing/widget/SwingNumberWidget.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ private void syncSliders() {
341341
/** Generate a suitable format pattern. */
342342
private String suitableFormat(Number... values) {
343343
Integer maxScale = Arrays.stream(values)
344-
.map(n -> new BigDecimal("" + n.doubleValue()).stripTrailingZeros().scale()).max(Integer::compare)
344+
.map(n -> new BigDecimal("" + (n == null ? 0.0 : n.doubleValue())).stripTrailingZeros().scale()).max(Integer::compare)
345345
.get();
346346
return formatForScale(maxScale);
347347
}

0 commit comments

Comments
 (0)