[Android] Prevent NPE on audio player loading

Geoffrey Métais git at videolan.org
Mon Apr 3 14:29:46 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr  3 11:52:59 2017 +0200| [58b55648f7267f3a7c7528845188bec3f1c7d514] | committer: Geoffrey Métais

Prevent NPE on audio player loading

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

 .../src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.java    | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.java b/vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.java
index 6f2d7c3..87ceec9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/BottomSheetBehavior.java
@@ -34,4 +34,13 @@ public class BottomSheetBehavior<V extends View> extends android.support.design.
             //Same crash, weakref not already set.
         }
     }
+
+    @Override
+    public boolean onTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) {
+        try {
+            return super.onTouchEvent(parent, child, event);
+        } catch (NullPointerException ignored) {
+            return false;
+        }
+    }
 }



More information about the Android mailing list