mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-02-18 04:10:45 +01:00
catching a weird exception
This commit is contained in:
parent
25b7521b46
commit
c05874b8d1
@ -384,8 +384,12 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
|||||||
private fun initModeSwitcher() {
|
private fun initModeSwitcher() {
|
||||||
val gestureDetector = GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() {
|
val gestureDetector = GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() {
|
||||||
override fun onFling(event1: MotionEvent, event2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
|
override fun onFling(event1: MotionEvent, event2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
|
||||||
// these can be null even if the docs say they cannot
|
// these can be null even if the docs say they cannot, getting event1.x in itself can cause crashes
|
||||||
if (event1 == null || event2 == null) {
|
try {
|
||||||
|
if (event1 == null || event2 == null || event1.x == null || event2.x == null) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} catch (e: NullPointerException) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user