[Android] Video player: prevent IllegalArgumentException

Geoffrey Métais git at videolan.org
Thu Oct 17 12:09:15 CEST 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct 17 10:19:22 2019 +0200| [e3c91b75f2037c285e581ee80880ab1d6835bdaf] | committer: Geoffrey Métais

Video player: prevent IllegalArgumentException

(cherry picked from commit 6c4c0dc5fc8b83dfa038f1a288455804adcd2144)

> https://code.videolan.org/videolan/vlc-android/commit/e3c91b75f2037c285e581ee80880ab1d6835bdaf
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt b/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
index 5dfdcfbf52..f3003c8938 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
@@ -134,8 +134,11 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
                 val xgesturesize = xChanged / screenConfig.metrics.xdpi * 2.54f
                 val deltaY = ((abs(initTouchY - event.y) / screenConfig.metrics.xdpi + 0.5f) * 2f).coerceAtLeast(1f)
 
-                val xTouch = event.x.roundToInt()
-                val yTouch = event.y.roundToInt()
+                val (xTouch, yTouch) = try {
+                    Pair(event.x.roundToInt(), event.y.roundToInt())
+                } catch (e: IllegalArgumentException) {
+                    return false
+                }
 
                 val now = System.currentTimeMillis()
                 when (event.action) {



More information about the Android mailing list