square / okio

A modern I/O library for Android, Java, and Kotlin Multiplatform.

Home Page:https://square.github.io/okio/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Closeable.use` throws NPE when `block` returns nullable

05nelsonm opened this issue · comments

block return type R is defined as <R>, not <R: Any>. If block produces null (e.g. Int?) and no exception is thrown, return will cause a KotlinNullPointerException.

A cast as R instead of a double banger is needed on result

image

PR incoming tomorrow