Skip to content

Commit

Permalink
Fix method call leaking input stream
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Nijmeh <tylernij@gmail.com>
  • Loading branch information
tytydraco committed Jun 30, 2023
1 parent f2d8bfb commit 4a61240
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ class MainActivityViewModel(application: Application) : AndroidViewModel(applica
}

val uri = Uri.parse(extra)
context.contentResolver.openInputStream(uri)?.bufferedReader().use {
it?.readText()
context.contentResolver.openInputStream(uri)?.use {
it.bufferedReader().use { buffered ->
buffered.readText()
}
}
}

Expand Down

0 comments on commit 4a61240

Please sign in to comment.