FileSaver close FileReader (#252)

* Update FileSaver.java

* Update FileSaver.java
This commit is contained in:
RacoonDog 2023-09-24 09:13:32 -04:00 committed by GitHub
parent c6cb3c0ee2
commit fa36d64a74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,8 +43,8 @@ public abstract class FileSaver {
public void init() {
if (file.exists()) {
JsonObject parentNode = null;
try {
parentNode = ViaFabricPlus.GSON.fromJson(new FileReader(file), JsonObject.class).getAsJsonObject();
try (final FileReader fr = new FileReader(file)) {
parentNode = ViaFabricPlus.GSON.fromJson(fr, JsonObject.class);
} catch (Exception e) {
e.printStackTrace();
}