Skip to content

Commit 875dac5

Browse files
authored
Merge pull request #2305 from OneSignal/npe-window-insets
fix: NPE when accessing WindowInsets used in isKeyboardUp()
2 parents 3a6e913 + 09ed4e2 commit 875dac5

File tree

1 file changed

+1
-1
lines changed
  • OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common

1 file changed

+1
-1
lines changed

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/DeviceUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object DeviceUtils {
3232
isOpen =
3333
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
3434
val imeInsets = view.rootWindowInsets
35-
imeInsets.isVisible(WindowInsetsCompat.Type.ime())
35+
imeInsets?.isVisible(WindowInsetsCompat.Type.ime()) ?: false
3636
} else {
3737
// Does not work for cases when keyboard is full screen for Android 9 and below
3838
val heightDiff = metrics.heightPixels - visibleBounds.bottom

0 commit comments

Comments
 (0)