Skip to content

Commit

Permalink
Merge pull request #88 from JeffinsonDarmawan/bug-fix-1
Browse files Browse the repository at this point in the history
Fix a bug on parser
  • Loading branch information
samuelory committed Apr 2, 2024
2 parents 5dd5baf + 3b41c21 commit a426e28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/florizz/core/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static Command parse (String input) throws FlorizzException {
command = new HelpCommand();
break;
case ("flowers"):
command = handleFlowerCommand(decodedInput[0] + " " + decodedInput[1]);
command = handleFlowerCommand(decodedInput);
break;
case ("info"):
command = handleInfoCommand(decodedInput[1]);
Expand Down Expand Up @@ -171,8 +171,8 @@ private static DeleteBouquetCommand handleDeleteBouquet(String input) throws Flo
* @param input The user input to be parsed.
* @return A FlowerCommand object corresponding to the parsed input.
*/
private static FlowerCommand handleFlowerCommand(String input) {
String occasion = (input.length() == 7) ? " " : input.substring(input.indexOf(" ") + 1).trim();
private static FlowerCommand handleFlowerCommand(String[] input) {
String occasion = (input[1] == null) ? " " : input[1].trim();
return new FlowerCommand(occasion);
}

Expand Down

0 comments on commit a426e28

Please sign in to comment.