MikeOrtiz / TouchImageView

Adds touch functionality to Android ImageView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Crash in GestureListener.onFling

thats-bot opened this issue · comments

Looks like null values are not handled correctly in onFling function.
Please, make the first parameter nullable to fix this.
override fun onFling(e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {

Fatal Exception: java.lang.NullPointerException
Parameter specified as non-null is null: method li.e.onFling, parameter e1
com.ortiz.touchview.TouchImageView$GestureListener.onFling (TouchImageView.java:12)
android.view.GestureDetector.onTouchEvent (GestureDetector.java:835)
com.ortiz.touchview.TouchImageView$PrivateOnTouchListener.onTouch (TouchImageView.kt:851)
android.view.View.dispatchTouchEvent (View.java:15072)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3923)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:3597)

Thanks

First parameter should be nullable
override fun onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {

And you are using a version < 3.3

Ahh sorry, moving to api34 needs this #555

@hannesa2 it was fast, thank you for the fix!