From 8100913489aa2f1c89692635920c7564ee1d9726 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 24 Oct 2021 22:28:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/local/ImportBookActivity.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt index 0d48016db..5ca79f230 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt @@ -138,13 +138,14 @@ class ImportBookActivity : VMBaseActivity { val rootUri = Uri.parse(lastPath) kotlin.runCatching { - DocumentFile.fromTreeUri(this, rootUri)?.let { - subDocs.clear() - rootDoc = FileDoc.fromDocumentFile(it) - upDocs(rootDoc!!) - } ?: let { + val doc = DocumentFile.fromTreeUri(this, rootUri) + if (doc == null || doc.name.isNullOrEmpty()) { binding.tvEmptyMsg.visible() selectFolder.launch(null) + } else { + subDocs.clear() + rootDoc = FileDoc.fromDocumentFile(doc) + upDocs(rootDoc!!) } }.onFailure { binding.tvEmptyMsg.visible()