Skip to content

Commit eca2a95

Browse files
author
LeonYang5114
committed
Fix bug of ignoring the step size of a parameter
The step size attribute of a parameter is always ignored because there is no converter that converts String to Number. The bug is fixed by parsing the String to double. Similar bug exists in the script editor and has been fixed. See also: c0ffe39 #205
1 parent 032cb85 commit eca2a95

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/org/scijava/command/CommandModuleItem.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,14 @@ public T getMaximumValue() {
145145

146146
@Override
147147
public Number getStepSize() {
148-
return tValue(getParameter().stepSize(), Number.class);
148+
final String value = getParameter().stepSize();
149+
try {
150+
final double stepSize = Double.parseDouble(value);
151+
return stepSize;
152+
}
153+
catch (final NumberFormatException exc) {
154+
return tValue(value, Number.class);
155+
}
149156
}
150157

151158
@Override

0 commit comments

Comments
 (0)