Kotlin : Error handling: catching NullPointerException