Honest question, what about using `!!` and catchin...
# codingconventions
a
Honest question, what about using
!!
and catching NPE? You could then write a function similar to
use
(don’t mind the naming):
Copy code
inline fun <T, R> T.suppressNpe(block: (T) -> R): R? = try {
    block(this)
} catch (e: NullPointerException) {
    null
}

fun foo(item: Item): Image? = item.suppressNpe {
    Image(it.url!!, it.link!!, it.itemWidth!!.toInt(), it.itemHeight!!.toInt())
}