Make the result variable non-null in Configuration.kt
This commit is contained in:
parent
de833629ec
commit
4b80235049
|
@ -16,7 +16,7 @@ object Configuration {
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
@JvmField
|
@JvmField
|
||||||
val obtained: Config = run {
|
val obtained: Config = run {
|
||||||
var result: Config? = null
|
lateinit var result: Config
|
||||||
with(file) {
|
with(file) {
|
||||||
if (!exists()) {
|
if (!exists()) {
|
||||||
createNewFile()
|
createNewFile()
|
||||||
|
@ -26,10 +26,10 @@ object Configuration {
|
||||||
} else result = try {
|
} else result = try {
|
||||||
ConfigFactory.parseFile(file)
|
ConfigFactory.parseFile(file)
|
||||||
} catch (e: ConfigException) {
|
} 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")
|
ConfigFactory.load(result).getConfig("Snowy")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue