diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/config/JsonConfigurableInterface.java b/LauncherAPI/src/main/java/pro/gravit/launcher/config/JsonConfigurableInterface.java index 67b160f2..65c15c92 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/config/JsonConfigurableInterface.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/config/JsonConfigurableInterface.java @@ -41,7 +41,13 @@ default String toJsonString() { default void loadConfig(Gson gson, Path configPath) throws IOException { if (generateConfigIfNotExists(configPath)) return; try (BufferedReader reader = IOHelper.newReader(configPath)) { - setConfig(gson.fromJson(reader, getType())); + T value = gson.fromJson(reader, getType()); + if(value == null) { + LogHelper.warning("Config %s is null", configPath); + resetConfig(configPath); + return; + } + setConfig(value); } catch (Exception e) { LogHelper.error(e); resetConfig(configPath);