From c3ba0fe0121b8eff1056fadfde5b8992d4aafe21 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:48:27 +1000 Subject: Fix: Corrupt config files not resetting to default state (#2055) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java') 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 } -- cgit