Guard against null events passed to onScroll
It appears that on some devices, e1 can be null, which would result in a crash. This is probably due to manufacturers messing with input handling of AOSP.
This commit is contained in:
parent
1fe3dedc52
commit
09a4990433
1 changed files with 3 additions and 2 deletions
|
|
@ -220,8 +220,9 @@ class TouchHandler(private val viewModel: VncViewModel, private val dispatcher:
|
|||
return true
|
||||
}
|
||||
|
||||
override fun onScroll(e1: MotionEvent, e2: MotionEvent, dX: Float, dY: Float): Boolean {
|
||||
val startPoint = e1.point()
|
||||
override fun onScroll(e1: MotionEvent?, e2: MotionEvent, dX: Float, dY: Float): Boolean {
|
||||
// As weird as it may be, e1 can be null on some devices
|
||||
val startPoint = e1?.point() ?: return false
|
||||
val currentPoint = e2.point()
|
||||
val normalizedDx = -dX * swipeSensitivity
|
||||
val normalizedDy = -dY * swipeSensitivity
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue