mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Reset null config
This commit is contained in:
parent
1cc3edd15b
commit
58d8ba2358
1 changed files with 7 additions and 1 deletions
|
@ -41,7 +41,13 @@ default String toJsonString() {
|
||||||
default void loadConfig(Gson gson, Path configPath) throws IOException {
|
default void loadConfig(Gson gson, Path configPath) throws IOException {
|
||||||
if (generateConfigIfNotExists(configPath)) return;
|
if (generateConfigIfNotExists(configPath)) return;
|
||||||
try (BufferedReader reader = IOHelper.newReader(configPath)) {
|
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) {
|
} catch (Exception e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
resetConfig(configPath);
|
resetConfig(configPath);
|
||||||
|
|
Loading…
Reference in a new issue