Skip to content

Commit

Permalink
checkstyle fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yeozongyao committed Mar 19, 2024
1 parent aff0082 commit 7e6f4bd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/seedu/bookbuddy/BookBuddy.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package seedu.bookbuddy;

import exceptions.UnsupportedCommandException;

import java.util.Scanner;

public class BookBuddy {
Expand All @@ -19,8 +21,17 @@ public static void getUserInput(BookList books) {

//noinspection InfiniteLoopStatement
while (true) {
String userInput = input.nextLine();
Parser.parseCommand(userInput, books);
String userInput = input.nextLine().trim();
if (userInput.isEmpty()) {
// If the input is empty, do not call parseCommand and just prompt for input again.
continue;
}

try {
Parser.parseCommand(userInput, books);
} catch (UnsupportedCommandException e) {
System.out.println(e.getMessage());
}
}
}

Expand Down

0 comments on commit 7e6f4bd

Please sign in to comment.