Skip to content

Commit e3f108a

Browse files
committed
Throw a friendly error message for empty files
Our counterpart of ra4king#99
1 parent 70b9bb0 commit e3f108a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/java/com/ra4king/circuitsim/gui/file/FileFormat.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ public static String stringify(CircuitFile circuitFile) {
290290

291291
public static CircuitFile load(File file, boolean taDebugMode) throws IOException {
292292
CircuitFile savedFile = parse(readFile(file));
293+
if (savedFile == null) {
294+
throw new NullPointerException("File is empty!");
295+
}
293296
if (!taDebugMode && !savedFile.revisionSignaturesAreValid()) {
294297
throw new NullPointerException("File is corrupted. Contact Course Staff for Assistance.");
295298
}

0 commit comments

Comments
 (0)