mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] Backport 'Reset null config'
This commit is contained in:
parent
e640219688
commit
098eff91e6
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