The program should print the host length when one value is available. Find the unsafe assumption.
kotlin
class FlakyConfig {
private var reads = 0
val host: String?
get() {
reads += 1
return if (reads == 1) "db.local" else null
}
}
fun main() {
val config = FlakyConfig()
if (config.host != null) {
println(config.host!!.length)
}
}