How do I tell Kotlin that a method can return null...
# announcements
d
How do I tell Kotlin that a method can return null? This code throws
java.lang.IllegalStateException: code must not be null
if
getHeader
returns null
Copy code
val code = request.getHeader("X-Confirmation-Code")
        if (code != null && codeAuthentication.isValidCode(phone, code)) {
            codeAuthentication.deleteCode(phone)
            return true
        }