diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index ec1359b63..20661274d 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -249,8 +249,11 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity } importSource -> if (resultCode == Activity.RESULT_OK) { data?.data?.let { - FileUtils.getPath(this, it)?.let { path -> + val path = FileUtils.getPath(this, it) + if (path != null) { viewModel.importSourceFromFilePath(path) + } else { + toast(R.string.uri_to_path_fail) } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b9d9f260a..dc4bb8af1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -540,5 +540,6 @@ 文件选择 文件夹选择 我是有底线的 + Uri转Path失败