adding a null check

This commit is contained in:
tibbi 2023-06-18 09:54:18 +02:00
parent febd62164d
commit d2c3116173
2 changed files with 4 additions and 4 deletions

View File

@ -65,7 +65,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:d5a26c4d27'
implementation 'com.github.SimpleMobileTools:Simple-Commons:d1ed742806'
implementation 'androidx.emoji2:emoji2-bundled:1.2.0'
kapt 'androidx.room:room-compiler:2.5.1'

View File

@ -749,12 +749,12 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
}
private fun clearClipboardContent() {
val clipboardManager = (context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)
val clipboardManager = (context.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager)
if (isPiePlus()) {
clipboardManager.clearPrimaryClip()
clipboardManager?.clearPrimaryClip()
} else {
val clip = ClipData.newPlainText("", "")
clipboardManager.setPrimaryClip(clip)
clipboardManager?.setPrimaryClip(clip)
}
}