Skip to content

Commit

Permalink
fixed deadlinecommand and eventcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
TriciaBK committed Oct 6, 2023
1 parent 7c3779d commit 0d63fc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/Commands/DeadlineCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public DeadlineCommand(String input) throws DukeFormatException {
throw new DukeFormatException("Ohno... Please check your format and include '/by'~");
} else {
String[] parts = input.split(" /by ");
if (parts[0].length() <= "deadline ".length()) {
if (parts[0].length() < "deadline ".length()) {
throw new DukeFormatException("Task cannot be empty :< Please provide a valid event description.");
}
task = parts[0].substring("deadline ".length());
if (parts.length != 2 || task.isEmpty() || parts[1].isEmpty()) {
if (parts.length != 2 || parts[1].isEmpty()) {
throw new DukeFormatException("Task or deadline cannot be empty... Please check your input again~");
}
deadline = parts[1];
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Commands/EventCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public EventCommand(String input) throws DukeFormatException {
throw new DukeFormatException("Uhoh... Please check your format and include '/from' and '/to'~");
} else {
String[] parts = input.split(" /");
if (parts[0].length() <= "event ".length()) {
if (parts[0].length() < "event ".length()) {
throw new DukeFormatException("Event cannot be empty :< Please provide a valid event description.");
}
task = parts[0].substring("event ".length());
Expand Down

0 comments on commit 0d63fc1

Please sign in to comment.