修复低版本手机打开本地文件出错的bug

pull/1500/head
gedoor 3 years ago
parent 707ead85d8
commit 609619412a
  1. 4
      app/src/main/java/io/legado/app/model/localBook/LocalBook.kt

@ -35,8 +35,12 @@ object LocalBook {
if (uri.isContentScheme()) { if (uri.isContentScheme()) {
return appCtx.contentResolver.openInputStream(uri)!! return appCtx.contentResolver.openInputStream(uri)!!
} }
val file = File(uri.path!!)
if (file.exists()) {
return FileInputStream(File(uri.path!!)) return FileInputStream(File(uri.path!!))
} }
throw FileNotFoundException("${uri.path} 文件不存在")
}
@Throws(Exception::class) @Throws(Exception::class)
fun getChapterList(book: Book): ArrayList<BookChapter> { fun getChapterList(book: Book): ArrayList<BookChapter> {

Loading…
Cancel
Save