[Android] Prevent NPE

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


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

Prevent NPE

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

 .../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