event at onTouchEvent can apparently be null, check it

This commit is contained in:
tibbi 2022-10-01 23:27:36 +02:00
parent f4ea085118
commit 38f3e4034f
1 changed files with 5 additions and 1 deletions

View File

@ -133,7 +133,11 @@ class MainActivity : SimpleActivity(), FlingListener {
(widgets_fragment as WidgetsFragment).onConfigurationChanged() (widgets_fragment as WidgetsFragment).onConfigurationChanged()
} }
override fun onTouchEvent(event: MotionEvent): Boolean { override fun onTouchEvent(event: MotionEvent?): Boolean {
if (event == null) {
return false
}
if (mLongPressedIcon != null && event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) { if (mLongPressedIcon != null && event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) {
mLastUpEvent = System.currentTimeMillis() mLastUpEvent = System.currentTimeMillis()
} }