Skip to content

Commit

Permalink
Don't crash on empty config
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Jan 7, 2025
1 parent d716e9c commit ecfd264
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ public AbstractSave(final String name) {
public void init() {
if (Files.exists(path)) {
try {
read(GSON.fromJson(Files.readString(path), JsonObject.class));
final JsonObject object = GSON.fromJson(Files.readString(path), JsonObject.class);
if (object != null) {
read(object);
} else {
ViaFabricPlusImpl.INSTANCE.logger().error("The file {} is empty!", path.getFileName());
}
} catch (IOException e) {
ViaFabricPlusImpl.INSTANCE.logger().error("Failed to read file: {}!", path.getFileName(), e);
}
Expand Down

0 comments on commit ecfd264

Please sign in to comment.