[Android] Prevent NPE

Geoffrey Métais git at videolan.org
Wed Jun 22 18:07:02 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jun 22 15:50:04 2016 +0200| [58b1f669c3223d3cefe2765a49165b2cef07ebad] | committer: Geoffrey Métais

Prevent NPE

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

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

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 9d828c1..a1c8d1c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -3042,10 +3042,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                     mHandler.post(new Runnable() {
                         @Override
                         public void run() {
-                            for(String file : mSubtitleSelectedFiles) {
-                                Log.i(TAG, "Adding user-selected subtitle " + file);
-                                mService.addSubtitleTrack(file, true);
-                            }
+                            if (mService != null)
+                                for(String file : mSubtitleSelectedFiles) {
+                                    Log.i(TAG, "Adding user-selected subtitle " + file);
+                                    mService.addSubtitleTrack(file, true);
+                                }
                         }
                     });
                 }



More information about the Android mailing list