[Android] Prevent NPE on SurfaceTextureThread

Geoffrey Métais git at videolan.org
Tue May 30 09:31:42 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 30 09:30:08 2017 +0200| [9651be2c132d2fb5c4f734ce7922148b893ccf56] | committer: Geoffrey Métais

Prevent NPE on SurfaceTextureThread

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

 libvlc/src/org/videolan/libvlc/AWindow.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/AWindow.java b/libvlc/src/org/videolan/libvlc/AWindow.java
index 9f1ca4596..396c5c10e 100644
--- a/libvlc/src/org/videolan/libvlc/AWindow.java
+++ b/libvlc/src/org/videolan/libvlc/AWindow.java
@@ -362,7 +362,8 @@ public class AWindow implements IVLCVout {
             cb.onSurfacesDestroyed(this);
         if (mSurfaceCallback != null)
             mSurfaceCallback.onSurfacesDestroyed(this);
-        mSurfaceTextureThread.release();
+        if (AndroidUtil.isJellyBeanOrLater)
+            mSurfaceTextureThread.release();
     }
 
     @Override
@@ -760,10 +761,7 @@ public class AWindow implements IVLCVout {
      */
     @SuppressWarnings("unused") /* used by JNI */
     boolean SurfaceTexture_attachToGLContext(int texName) {
-        if (AndroidUtil.isJellyBeanOrLater) {
-            return mSurfaceTextureThread.attachToGLContext(texName);
-        } else
-            return false;
+        return AndroidUtil.isJellyBeanOrLater && mSurfaceTextureThread.attachToGLContext(texName);
     }
 
     /**



More information about the Android mailing list