diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-06-13 00:48:27 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 16:48:27 +0200 |
commit | c3ba0fe0121b8eff1056fadfde5b8992d4aafe21 (patch) | |
tree | 87c51dc4cb66145766e8c17fa520b4d9880cd2a8 /src | |
parent | ed7f4407b5eedceb127546f8ee145b4ce48741f0 (diff) | |
download | skyhanni-c3ba0fe0121b8eff1056fadfde5b8992d4aafe21.tar.gz skyhanni-c3ba0fe0121b8eff1056fadfde5b8992d4aafe21.tar.bz2 skyhanni-c3ba0fe0121b8eff1056fadfde5b8992d4aafe21.zip |
Fix: Corrupt config files not resetting to default state (#2055)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index 5bee8eab3..6be199cb7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -157,7 +157,7 @@ class ConfigManager { private fun firstLoadFile(file: File?, fileType: ConfigFileType, defaultValue: Any): Any { val fileName = fileType.fileName logger.log("Trying to load $fileName from $file") - var output: Any = defaultValue + var output: Any? = defaultValue if (file!!.exists()) { try { @@ -203,6 +203,10 @@ class ConfigManager { if (output == defaultValue) { logger.log("Setting $fileName to be blank as it did not exist. It will be saved once something is written to it") } + if (output == null) { + logger.log("Setting $fileName to be blank as it was null. It will be saved once something is written to it") + output = defaultValue + } return output } |