Skip to content

Commit

Permalink
Fix handling of todo without description
Browse files Browse the repository at this point in the history
  • Loading branch information
AlWo223 committed Oct 5, 2023
1 parent 59b591d commit 23842f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/duke/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public TaskList editTask(String argument, boolean done, TaskList tasks, Ui ui) {
public TaskList addToDo(String argument, TaskList tasks, Ui ui) {
if (argument == null || argument.isEmpty()) {
ui.printEmptyTodoMessage();
return tasks;
}
Task todo = new Todo(argument);
tasks.add(todo);
Expand Down
2 changes: 2 additions & 0 deletions text-ui-test/EXPECTED.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Ok, I have added the following task:
[D][ ] organize present for birthday party (by: Aug-08-2023 14:00)
Now you have 5 tasks in the list.
--------------------------------------------
I am sorry, the todo cannot be empty!
--------------------------------------------
--------------------------------------------
Have a wonderful day! Hope to see you again soon!
--------------------------------------------
1 change: 1 addition & 0 deletions text-ui-test/input.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ todo borrow book
find book
deadline apply to Harvard /by 2023-12-06 23:59
deadline organize present for birthday party /by 2023-08-08 14:00
todo
bye

0 comments on commit 23842f8

Please sign in to comment.