[Android] BottomSheet: catch IndexOutOfBoundsException

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


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct 17 11:47:29 2019 +0200| [df8d6fb6450d08078d2b978e2fd4d4fc3075ee02] | committer: Geoffrey Métais

BottomSheet: catch IndexOutOfBoundsException

(cherry picked from commit 3c361a4e3ea27e03f57f0ccf282d90099a97a73d)

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

 vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.kt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.kt
index f1f1aaf89..f747cd658 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.kt
@@ -86,6 +86,11 @@ class BottomSheetBehavior<V : View> : com.google.android.material.bottomsheet.Bo
         return false
     }
 
+    override fun onLayoutChild(parent: CoordinatorLayout, child: V, layoutDirection: Int)=  try {
+        super.onLayoutChild(parent, child, layoutDirection)
+    } catch (ignored: IndexOutOfBoundsException) {
+        false
+    }
 
     override fun onTouchEvent(parent: CoordinatorLayout, child: V, event: MotionEvent): Boolean {
         if (lock) return false



More information about the Android mailing list