Skip to content

Commit f47159f

Browse files
committed
Fix no config file crash
1 parent 4f85acd commit f47159f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/main/java/net/vulkanmod/config/Config.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public class Config {
3131
public boolean textureAnimations = true;
3232

3333
public void write() {
34-
35-
if(!Files.exists(CONFIG_PATH.getParent())) {
34+
if (!Files.exists(CONFIG_PATH.getParent())) {
3635
try {
3736
Files.createDirectories(CONFIG_PATH);
3837
} catch (IOException e) {
@@ -61,13 +60,13 @@ public static Config load(Path path) {
6160
if (Files.exists(path)) {
6261
try (FileReader fileReader = new FileReader(path.toFile())) {
6362
config = GSON.fromJson(fileReader, Config.class);
64-
}
65-
catch (IOException exception) {
63+
} catch (IOException exception) {
6664
throw new RuntimeException(exception.getMessage());
6765
}
6866
}
6967
else {
70-
config = null;
68+
config = new Config();
69+
config.write();
7170
}
7271

7372
return config;

0 commit comments

Comments
 (0)