val a:Boolean? = false
// if I set break point here and set a = null,
// then resume program will show NullPointerException
1.run {
a?.let { false } // line 104
}.apply {
println(a)
}
Exception in thread “main” java.lang.NullPointerException
at TestKt.main(Test.kt:104)
at TestKt.main(Test.kt)
In real project, the location of “1” and “a” are two function, they will return the same type value, so I need “?.” for null safety, but when “a” return null, the NullPointerException will happen