From 4b80235049a43466cc070a52e0842b560eac12c4 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Thu, 22 Apr 2021 16:48:54 +0200 Subject: [PATCH] Make the result variable non-null in Configuration.kt --- .../kotlin/fr/username404/snowygui/config/Configuration.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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") } }