aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-06-13 00:48:27 +1000
committerGitHub <noreply@github.com>2024-06-12 16:48:27 +0200
commitc3ba0fe0121b8eff1056fadfde5b8992d4aafe21 (patch)
tree87c51dc4cb66145766e8c17fa520b4d9880cd2a8 /src/main/java
parented7f4407b5eedceb127546f8ee145b4ce48741f0 (diff)
downloadskyhanni-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/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt6
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
}