[Android] LibVLC: Do not allow to attach non existent views

Geoffrey Métais git at videolan.org
Mon Feb 18 17:46:23 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 18 17:43:42 2019 +0100| [dc832cf43d5941eca0529b495b56dee12828e8a1] | committer: Geoffrey Métais

LibVLC: Do not allow to attach non existent views

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

 libvlc/src/org/videolan/libvlc/VideoHelper.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libvlc/src/org/videolan/libvlc/VideoHelper.java b/libvlc/src/org/videolan/libvlc/VideoHelper.java
index b03dc3ece..6ce42385a 100644
--- a/libvlc/src/org/videolan/libvlc/VideoHelper.java
+++ b/libvlc/src/org/videolan/libvlc/VideoHelper.java
@@ -83,6 +83,7 @@ class VideoHelper implements IVLCVout.OnNewVideoLayoutListener {
     }
 
     void attachViews() {
+        if (mVideoSurface == null && mVideoTexture == null) return;
         final IVLCVout vlcVout = mMediaPlayer.getVLCVout();
         if (mVideoSurface != null) {
             vlcVout.setVideoView(mVideoSurface);
@@ -115,7 +116,7 @@ class VideoHelper implements IVLCVout.OnNewVideoLayoutListener {
     }
 
     void detachViews() {
-        if (mOnLayoutChangeListener != null) {
+        if (mOnLayoutChangeListener != null && mVideoSurfaceFrame != null) {
             mVideoSurfaceFrame.removeOnLayoutChangeListener(mOnLayoutChangeListener);
             mOnLayoutChangeListener = null;
         }



More information about the Android mailing list