[Android] BottomSheet: catch IndexOutOfBoundsException

Geoffrey Métais git at videolan.org
Thu Oct 17 11:55:25 CEST 2019


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

BottomSheet: catch IndexOutOfBoundsException

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

 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