From fc886ae96986c685e714901898016ce455b4ef15 Mon Sep 17 00:00:00 2001 From: Bill Kuker Date: Tue, 1 Sep 2009 00:04:25 +0000 Subject: [PATCH] Fixed case where "0.9 mm" wouldnt work --- src/com/billkuker/rocketry/motorsim/visual/Editor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/billkuker/rocketry/motorsim/visual/Editor.java b/src/com/billkuker/rocketry/motorsim/visual/Editor.java index 8bae23c..fa458c4 100644 --- a/src/com/billkuker/rocketry/motorsim/visual/Editor.java +++ b/src/com/billkuker/rocketry/motorsim/visual/Editor.java @@ -144,7 +144,13 @@ public class Editor extends PropertySheetPanel { // Storing the old unit allows you to type 10 into a field // that says 20 mm and get 10 mm, so you dont have to // type the unit if they havn't changed. - Amount a = Amount.valueOf(editor.getText()); + + //Amount wants a leading 0 + if (text.startsWith(".")){ + text = "0" + text; + } + + Amount a = Amount.valueOf(text); oldUnit = a.getUnit(); return a; } -- 2.47.2