fun foo(p: List): Int { val v = p[0] ?: return -1 // return -1 if null return v.length }