Skip to content

Commit

Permalink
Fix crashing when clipboard test is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlaster committed Dec 13, 2019
1 parent 37d20a5 commit 4b251d4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit 4b251d4

Please sign in to comment.