aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-07-17 00:27:55 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2022-07-17 13:56:43 +0530
commit6ceedc049c1ca3cd2d18a612e96140d0d58f257e (patch)
treece950fc013dd6f2bf1944d3f1f961ef74870249d
parentd6464159779dd5c9027429ad636a5fa6a1225bee (diff)
PGPKeyImportActivity: close key stream after use
-rw-r--r--app/src/main/java/app/passwordstore/ui/pgp/PGPKeyImportActivity.kt2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyImportActivity.kt b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyImportActivity.kt
index 69b40a2e..cd4ab07f 100644
--- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyImportActivity.kt
+++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyImportActivity.kt
@@ -34,7 +34,7 @@ class PGPKeyImportActivity : AppCompatActivity() {
val keyInputStream =
contentResolver.openInputStream(uri)
?: throw IllegalStateException("Failed to open selected file")
- val bytes = keyInputStream.readBytes()
+ val bytes = keyInputStream.use { `is` -> `is`.readBytes() }
val (key, error) = runBlocking { keyManager.addKey(PGPKey(bytes)) }
if (error != null) throw error
key