Skip to content

Commit

Permalink
Merge pull request #105 from samuelory/Samuel-V2.2
Browse files Browse the repository at this point in the history
Fixed unhandled exception in add and remove
  • Loading branch information
samuelory committed Apr 3, 2024
2 parents 2b3dccb + 3198abe commit 9119497
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/florizz/core/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public static String[] commandHandler(String input) throws FlorizzException {
String[] arguments = new String[2];
String trimmedArgument = trimmedInput.substring(firstWhitespace).trim();
int secondWhitespace = trimmedArgument.indexOf(" ");
if (secondWhitespace <0){
throw new FlorizzException("Incorrect usage of remove." +
" Correct format: remove <flowerName> /q <quantity> /from <bouquetName>");
}
arguments[0] = FuzzyLogic.detectItem(trimmedArgument.substring(0,secondWhitespace));
arguments[1] = trimmedArgument.substring(secondWhitespace).trim();
outputs[1] = arguments[0] + " " + arguments[1];
Expand Down

0 comments on commit 9119497

Please sign in to comment.