Try to avoid occasional swipe related crashes due to null MotionEvents

This commit is contained in:
Juha Heinanen
2022-09-11 18:10:09 +03:00
parent a558eab7ff
commit 701e97a722

View File

@ -22,7 +22,13 @@ open class OnSwipeTouchListener(ctx: Context) : View.OnTouchListener {
@SuppressLint("ClickableViewAccessibility")
override fun onTouch(view: View?, event: MotionEvent): Boolean {
return gestureDetector.onTouchEvent(event)
return try {
gestureDetector.onTouchEvent(event)
} catch (e: Exception) {
Log.e(TAG, "onTouch exception $e")
e.printStackTrace()
false
}
}
private inner class GestureListener : GestureDetector.SimpleOnGestureListener() {