From 4b251d4cf3e5dae99dcf7e4d3a6cfc11e36dc0da Mon Sep 17 00:00:00 2001 From: Tlaster Date: Fri, 13 Dec 2019 11:19:53 +0800 Subject: [PATCH] Fix crashing when clipboard test is null --- .../tessercubecore/common/extension/ContextExtensions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tessercubecore/src/main/java/com/sujitech/tessercubecore/common/extension/ContextExtensions.kt b/tessercubecore/src/main/java/com/sujitech/tessercubecore/common/extension/ContextExtensions.kt index 2ec4ead..da64613 100644 --- a/tessercubecore/src/main/java/com/sujitech/tessercubecore/common/extension/ContextExtensions.kt +++ b/tessercubecore/src/main/java/com/sujitech/tessercubecore/common/extension/ContextExtensions.kt @@ -21,7 +21,7 @@ fun Context.getClipboardText(): String { val primaryClip = clipboardManager.primaryClip if (primaryClip != null && primaryClip.itemCount > 0) { val firstItem = primaryClip.getItemAt(0) - return firstItem.text.toString() + return firstItem?.text?.toString() ?: "" } } return ""