diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt index 406fd2b..1cd24aa 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt @@ -16,7 +16,7 @@ object Configuration { """.trimMargin() @JvmField val obtained: Config = run { - var result: Config? = null + lateinit var result: Config with(file) { if (!exists()) { createNewFile() @@ -26,10 +26,10 @@ object Configuration { } else result = try { ConfigFactory.parseFile(file) } catch (e: ConfigException) { - Snowy.logs.warn("Could not parse the snowy configuration file, the default configuration will be used instead."); null + Snowy.logs.warn("Could not parse the snowy configuration file, the default configuration will be used instead.") + ConfigFactory.parseString(base) } } - if (result == null) result = ConfigFactory.parseString(base) ConfigFactory.load(result).getConfig("Snowy") } }