Browse Source

Fix amount parsing for COUNT.

Sam Jaffe 5 years ago
parent
commit
9151a0bbd1
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/main/lombok/org/leumasjaffe/recipe/model/Amount.java

+ 4 - 1
src/main/lombok/org/leumasjaffe/recipe/model/Amount.java

@@ -49,6 +49,9 @@ public class Amount {
 		final String[] tokens = serial.split(" ", 2);
 		unit = Unit.COUNT;
 		value = Double.parseDouble(tokens[0]);
+		if (tokens.length == 1) {
+			return;
+		}
 		final Optional<Volume> rv = Stream.of(Volume.values())
 				.filter(v -> v.displayName.equals(tokens[1])).findFirst();
 		if (rv.isPresent()) {
@@ -83,7 +86,7 @@ public class Amount {
 		case VOLUME:
 			return vol.displayName;
 		default:
-			return "";
+			return "ct";
 		}
 	}