Skip to content

Commit

Permalink
Fix bug where exit was not working as intended
Browse files Browse the repository at this point in the history
  • Loading branch information
kerkpy committed Oct 8, 2020
1 parent a3b1eb8 commit e15c0a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ private boolean isValidInput(String fullInput) throws DukeException {
isValidDate(atString);
return true;

} else if (fullInput.equals("list") || fullInput.startsWith("delete ") || fullInput.startsWith("done ")) {
} else if (fullInput.equals("list") || fullInput.startsWith("delete ") || fullInput.startsWith("done ")
|| fullInput.equals("bye")) {
return true;

} else {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import duke.Duke;

import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
Expand Down Expand Up @@ -56,6 +57,9 @@ private void handleUserInput() {
DialogBox.getUserDialog(userText, userImage),
DialogBox.getDukeDialog(dukeText, dukeImage)
);
if (userText.equals("bye")) {
Platform.exit();
}
userInput.clear();
}

Expand Down

0 comments on commit e15c0a8

Please sign in to comment.