Skip to content

Commit

Permalink
Merge branch 'master' into branch-A-CodeQuality
Browse files Browse the repository at this point in the history
  • Loading branch information
HugeNoob committed Sep 10, 2023
2 parents 92c7332 + 9bba8f7 commit 23eda7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/duke/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import duke.exceptions.DukeException;
import duke.exceptions.DukeIoException;
Expand Down Expand Up @@ -83,6 +84,7 @@ public void load(TaskList tasklist) throws DukeException {
* @throws DukeException If there is an error saving tasks to the save file.
*/
public void save(TaskList tasklist) throws DukeException {
assert Files.exists(Paths.get(this.path)) : "Save file should exist before saving tasks to file.";
try {
String content = "";
FileWriter fileWriter = new FileWriter(path, false);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/duke/tasks/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public abstract class Task {
* @param input The description of the task.
*/
public Task(String input) {
assert input != null && input != "" : "Description of a task should not be empty.";
this.description = input;
this.isDone = false;
}
Expand Down

0 comments on commit 23eda7d

Please sign in to comment.