Make the result variable non-null in Configuration.kt

This commit is contained in:
Username404-59 2021-04-22 16:48:54 +02:00
parent de833629ec
commit 4b80235049
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 3 deletions

View File

@ -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")
}
}