From 6ceedc049c1ca3cd2d18a612e96140d0d58f257e Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 17 Jul 2022 00:27:55 +0530 Subject: PGPKeyImportActivity: close key stream after use --- app/src/main/java/app/passwordstore/ui/pgp/PGPKeyImportActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') 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 -- cgit v1.2.3