Since the change in #703, the app crashes if mAttachInfo inside a View is null.
java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.os.IBinder.isBinderAlive()' on a null object reference
at com.skydoves.balloon.Balloon.canShowBalloonWindow(Balloon.kt:923)
at com.skydoves.balloon.Balloon.show(Balloon.kt:796)
Expected Behavior:
The code should be modified as follows:
private fun canShowBalloonWindow(anchor: View): Boolean {
...
// We should check the anchor view is attached to the parent's window.
if (!anchor.isAttachedToWindow) return false
// We should check if the anchor view's window token is valid.
return anchor.windowToken.isBinderAlive
}
The isAttachedToWindow function compares mAttachInfo != null, so it is preferable to reference the windowToken only after this check.
Please complete the following information:
Describe the Bug:
Since the change in #703, the app crashes if
mAttachInfo
inside a View is null.Expected Behavior:
The code should be modified as follows:
The
isAttachedToWindow
function comparesmAttachInfo != null
, so it is preferable to reference thewindowToken
only after this check.