diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportationFilesManager.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportationFilesManager.kt index 682e0b314..22d115628 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportationFilesManager.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportationFilesManager.kt @@ -118,10 +118,11 @@ class ImportationFilesManager @Inject constructor( } private fun openInputStream(uri: Uri): InputStream? { - return appContext.contentResolver.openInputStream(uri) ?: run { - SentryLog.w(ImportLocalStorage.TAG, "During local copy of the file openInputStream returned null") - null - } + return runCatching { appContext.contentResolver.openInputStream(uri) } + .onSuccess { + if (it == null) SentryLog.w(ImportLocalStorage.TAG, "During local copy of the file openInputStream returned null") + } + .getOrNull() } private fun getRestoredFileUi(localFiles: Array): List {