From 765608a8450721dc66cf076a9032be5e5822bc2d Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 4 Aug 2021 16:10:37 +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 --- app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt | 2 +- app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt b/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt index dcabe5b8c..5bf92439c 100644 --- a/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt +++ b/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt @@ -20,7 +20,7 @@ class QrCodeActivity : BaseActivity(), OnScanResul override val binding by viewBinding(ActivityQrcodeCaptureBinding::inflate) private val selectQrImage = registerForActivityResult(ActivityResultContracts.GetContent()) { - it.readBytes(this)?.let { bytes -> + it?.readBytes(this)?.let { bytes -> val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size) onScanResultCallback(QRCodeUtils.parseCodeResult(bitmap)) } diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt index 1728f7320..a8ebdd2a3 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt @@ -43,6 +43,7 @@ class ReadRssActivity : VMBaseActivity private var customWebViewCallback: WebChromeClient.CustomViewCallback? = null private var webPic: String? = null private val saveImage = registerForActivityResult(FilePicker()) { + it ?: return@registerForActivityResult ACache.get(this).put(imagePathKey, it.toString()) viewModel.saveImage(webPic, it.toString()) }