[Android] Prevent NPE with subtitles tracks

Geoffrey Métais git at videolan.org
Tue Mar 3 11:22:50 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar  3 11:21:52 2015 +0100| [b5cf293bdae019e3f2a6d7a87cd1fb1d89ab4b0b] | committer: Geoffrey Métais

Prevent NPE with subtitles tracks

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b5cf293bdae019e3f2a6d7a87cd1fb1d89ab4b0b
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java        |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 3272405..3305020 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1949,6 +1949,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
     }
 
     private void selectSubtitles() {
+        if (mSubtitleTracksList == null)
+                mSubtitleTracksList = mLibVLC.getSpuTrackDescription();
         final String[] arrList = new String[mSubtitleTracksList.size()];
         int i = 0;
         int listPosition = 0;
@@ -1973,7 +1975,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
                         break;
                     }
                 }
-                if(trackID < -1) return;
+                if (trackID < -1) return;
 
                 MediaDatabase.getInstance().updateMedia(
                         mLocation,



More information about the Android mailing list