From b834201737cb2ec061f0e77ba01bd67c1bbf6007 Mon Sep 17 00:00:00 2001 From: Leobuaa Date: Sun, 18 Feb 2024 11:14:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20NPE=20crash=20problem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #13 --- .../src/main/kotlin/clipboard/watcher/ClipboardWatcherPlugin.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/kotlin/clipboard/watcher/ClipboardWatcherPlugin.kt b/android/src/main/kotlin/clipboard/watcher/ClipboardWatcherPlugin.kt index c8d4937..b46d340 100644 --- a/android/src/main/kotlin/clipboard/watcher/ClipboardWatcherPlugin.kt +++ b/android/src/main/kotlin/clipboard/watcher/ClipboardWatcherPlugin.kt @@ -107,7 +107,7 @@ class ClipboardWatcherPlugin : FlutterPlugin, val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager val clipData = clipboardManager.primaryClip if (clipData != null && clipData.itemCount > 0) { - val currentClipboardContent = clipData.getItemAt(0).text.toString() + val currentClipboardContent = clipData.getItemAt(0).text?.toString() if (currentClipboardContent != lastClipboardContent) { lastClipboardContent = currentClipboardContent channel.invokeMethod("onClipboardChanged", emptyMap())