Skip to content

Commit 2cc8b1b

Browse files
committed
DefaultModuleService: default 0 for numbers only
For non-numeric types, the default should simply be null. Fixes #168.
1 parent d5a16e3 commit 2cc8b1b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/scijava/module/DefaultModuleService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,10 @@ public <T> T getDefaultValue(final ModuleItem<T> item) {
312312
if (max != null) return max;
313313
final T softMax = item.getSoftMaximum();
314314
if (softMax != null) return softMax;
315-
final T zero = convertService.convert("0", item.getType());
316-
if (zero != null) return zero;
315+
if (Number.class.isAssignableFrom(item.getType())) {
316+
final T zero = convertService.convert("0", item.getType());
317+
if (zero != null) return zero;
318+
}
317319
// no known default value
318320
return null;
319321
}

0 commit comments

Comments
 (0)