Fixed crash when loading an invalid config

This commit is contained in:
Sollace 2023-09-10 20:04:52 +01:00
parent eace54f36a
commit c6d5b75896
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -48,7 +48,11 @@ public class Unicopia implements ModInitializer {
public static Config getConfig() { public static Config getConfig() {
if (CONFIG == null) { if (CONFIG == null) {
CONFIG = new Config(); CONFIG = new Config();
try {
CONFIG.load(); CONFIG.load();
} catch (IllegalStateException ignored) {
CONFIG.save();
}
} }
return CONFIG; return CONFIG;
} }