Spot the bug in the name-length function

from Kotlin fundamentals
Kotlin 2.4.10 beginner 4 min 1 issue to find

Find the bug in this function, which should return zero for a missing name.

kotlin
fun displayLength(name: String?): Int {
    if (name == null) {
        println("missing")
    }
    return name!!.length
}
Open in playground
Report an error