From abd1949d6edd040ca216b7390c5bb70ffd74c651 Mon Sep 17 00:00:00 2001
From: JJtan <95962077+JJtan2002@users.noreply.github.com>
Date: Thu, 7 Nov 2024 22:32:20 +0800
Subject: [PATCH] Fix addgame throwing illegalArgumentException
---
.../java/seedu/address/logic/commands/AddGameCommand.java | 7 ++++++-
src/main/resources/view/HelpWindow.fxml | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/address/logic/commands/AddGameCommand.java b/src/main/java/seedu/address/logic/commands/AddGameCommand.java
index 554e87a299e..3e44ac59ddf 100644
--- a/src/main/java/seedu/address/logic/commands/AddGameCommand.java
+++ b/src/main/java/seedu/address/logic/commands/AddGameCommand.java
@@ -82,7 +82,12 @@ public CommandResult execute(Model model) throws CommandException {
throw new CommandException(MESSAGE_GAME_EXISTS);
}
- Game editedGame = createNewGame(gameName, addGameDescriptor);
+ Game editedGame;
+ try {
+ editedGame = createNewGame(gameName, addGameDescriptor);
+ } catch (IllegalArgumentException e) {
+ throw new CommandException(e.getMessage());
+ }
gameMap.put(gameName, editedGame);
model.setPerson(personToEdit, personToEdit);
model.addCommandToLog(this);
diff --git a/src/main/resources/view/HelpWindow.fxml b/src/main/resources/view/HelpWindow.fxml
index 577f771c9b6..8a0468a0a8d 100644
--- a/src/main/resources/view/HelpWindow.fxml
+++ b/src/main/resources/view/HelpWindow.fxml
@@ -21,7 +21,7 @@
-
+