From 609619412aee9d99f910939c28904dbb0cde6dbd Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 5 Jan 2022 08:06:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=8E=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E6=89=93=E5=BC=80=E6=9C=AC=E5=9C=B0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=87=BA=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/model/localBook/LocalBook.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt index bf814dbbc..ea499d4d8 100644 --- a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt +++ b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt @@ -35,7 +35,11 @@ object LocalBook { if (uri.isContentScheme()) { return appCtx.contentResolver.openInputStream(uri)!! } - return FileInputStream(File(uri.path!!)) + val file = File(uri.path!!) + if (file.exists()) { + return FileInputStream(File(uri.path!!)) + } + throw FileNotFoundException("${uri.path} 文件不存在") } @Throws(Exception::class)