Fixed case where "0.9 mm" wouldnt work
authorBill Kuker <bkuker@billkuker.com>
Tue, 1 Sep 2009 00:04:25 +0000 (00:04 +0000)
committerBill Kuker <bkuker@billkuker.com>
Tue, 1 Sep 2009 00:04:25 +0000 (00:04 +0000)
src/com/billkuker/rocketry/motorsim/visual/Editor.java

index 8bae23cb3acdda0eea2424afa5816853cd2a001f..fa458c4a11c40e3ad6ded2a3e111201ac0cb2537 100644 (file)
@@ -144,7 +144,13 @@ public class Editor extends PropertySheetPanel {
                                // Storing the old unit allows you to type 10 into a field\r
                                // that says 20 mm and get 10 mm, so you dont have to\r
                                // type the unit if they havn't changed.\r
-                               Amount a = Amount.valueOf(editor.getText());\r
+                               \r
+                               //Amount wants a leading 0\r
+                               if (text.startsWith(".")){\r
+                                       text = "0" + text;\r
+                               }\r
+                               \r
+                               Amount a = Amount.valueOf(text);\r
                                oldUnit = a.getUnit();\r
                                return a;\r
                        }\r