summaryrefslogtreecommitdiff
path: root/src/org/unitConverter/converterGUI/UnitConverterGUI.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/unitConverter/converterGUI/UnitConverterGUI.java')
-rwxr-xr-xsrc/org/unitConverter/converterGUI/UnitConverterGUI.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/unitConverter/converterGUI/UnitConverterGUI.java b/src/org/unitConverter/converterGUI/UnitConverterGUI.java
index a70e971..867211c 100755
--- a/src/org/unitConverter/converterGUI/UnitConverterGUI.java
+++ b/src/org/unitConverter/converterGUI/UnitConverterGUI.java
@@ -175,7 +175,12 @@ final class UnitConverterGUI {
// try to parse to
final Unit to;
try {
- to = this.units.getUnitFromExpression(toUnitString);
+ // if it's a unit, convert to that
+ if (this.units.containsUnitName(toUnitString)) {
+ to = this.units.getUnit(toUnitString);
+ } else {
+ to = this.units.getUnitFromExpression(toUnitString);
+ }
} catch (final IllegalArgumentException e) {
this.view.showErrorDialog("Parse Error", "Could not recognize text in To entry: " + e.getMessage());
return;