Skip to content

Commit

Permalink
Arrays are fun, said no one ever
Browse files Browse the repository at this point in the history
  • Loading branch information
The Judge committed Apr 13, 2024
1 parent 62b289a commit 77e1345
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/pojlib/instance/InstanceHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ public static MinecraftInstances.Instance create(Activity activity, String insta
instances = GsonUtils.jsonFileToObject(gameDir + "/instances.json", MinecraftInstances.class);
} catch (Exception e) {
instances = new MinecraftInstances();
instances.instances = new MinecraftInstances.Instance[0];
}

if(instances == null) {
instances = new MinecraftInstances();
instances.instances = new MinecraftInstances.Instance[0];
GsonUtils.objectToJsonFile(gameDir + "/instances.json", instances);
}

Expand All @@ -144,9 +146,11 @@ public static MinecraftInstances load(String gameDir) {
instances = GsonUtils.jsonFileToObject(gameDir + "/instances.json", MinecraftInstances.class);
} catch (Exception e) {
instances = new MinecraftInstances();
instances.instances = new MinecraftInstances.Instance[0];
}
if(instances == null) {
instances = new MinecraftInstances();
instances.instances = new MinecraftInstances.Instance[0];
GsonUtils.objectToJsonFile(gameDir + "/instances.json", instances);
}

Expand Down

0 comments on commit 77e1345

Please sign in to comment.