[Android] Video player: Prevent NPE

Geoffrey Métais git at videolan.org
Thu Dec 20 16:56:27 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 20 16:56:06 2018 +0100| [698e88981953fbe0123e94aad0bf48992027d46c] | committer: Geoffrey Métais

Video player: Prevent NPE

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 4 ++--
 1 file changed, 2 insertions(+), 2 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 86b89150b..71a09915e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2461,8 +2461,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
             }
             positionInPlaylist = extras.getInt(Constants.PLAY_EXTRA_OPENED_POSITION, -1);
 
-            if (intent.hasExtra(Constants.PLAY_EXTRA_SUBTITLES_LOCATION))
-                mService.addSubtitleTrack(extras.getString(Constants.PLAY_EXTRA_SUBTITLES_LOCATION), true);
+            final String path = extras.getString(Constants.PLAY_EXTRA_SUBTITLES_LOCATION);
+            if (!TextUtils.isEmpty(path)) mService.addSubtitleTrack(path, true);
             if (intent.hasExtra(Constants.PLAY_EXTRA_ITEM_TITLE))
                 itemTitle = extras.getString(Constants.PLAY_EXTRA_ITEM_TITLE);
         }



More information about the Android mailing list