Skip to content

Commit

Permalink
Fix uninitialized field bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NereusWB922 committed Sep 17, 2023
1 parent b48131c commit f4cc880
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/corgi/commands/AddTaskCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import java.util.Stack;

import corgi.State;
import corgi.tasks.Deadline;
import corgi.tasks.Event;
import corgi.tasks.Task;
import corgi.tasks.TaskList;
import corgi.tasks.ToDo;
import corgi.ui.TextRenderer;
import javafx.util.Pair;

Expand Down Expand Up @@ -33,6 +36,13 @@ public class AddTaskCommand extends Command {
public AddTaskCommand(Task target) {
super(false);
this.target = target;
if (target instanceof ToDo) {
this.taskType = "todo";
} else if (target instanceof Deadline) {
this.taskType = "deadline";
} else if (target instanceof Event) {
this.taskType = "event";
}
}

/**
Expand Down

0 comments on commit f4cc880

Please sign in to comment.