[Android] VideoPlayerActivity: nullity checks

Geoffrey Métais git at videolan.org
Tue Feb 5 15:31:14 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb  5 15:30:37 2019 +0100| [e6f043adff85e7acf4862991ee1d7fc1f2926604] | committer: Geoffrey Métais

VideoPlayerActivity: nullity checks

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 6 +++---
 1 file changed, 3 insertions(+), 3 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 9f3e3e932..fd82f748e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1442,7 +1442,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
                     handleVout(event.getVoutCount());
                 break;
             case MediaPlayer.Event.ESAdded:
-                if (mMenuIdx == -1) {
+                if (mService != null && mMenuIdx == -1) {
                     final MediaWrapper media = mMedialibrary.findMedia(mService.getCurrentMediaWrapper());
                     if (media == null) return;
                     if (event.getEsChangedType() == Media.Track.Type.Audio) {
@@ -1468,14 +1468,14 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
                     }
                 }
             case MediaPlayer.Event.ESDeleted:
-                if (mMenuIdx == -1 && event.getEsChangedType() == Media.Track.Type.Video) {
+                if (mService != null && mMenuIdx == -1 && event.getEsChangedType() == Media.Track.Type.Video) {
                     mHandler.removeMessages(CHECK_VIDEO_TRACKS);
                     mHandler.sendEmptyMessageDelayed(CHECK_VIDEO_TRACKS, 1000);
                 }
                 invalidateESTracks(event.getEsChangedType());
                 break;
             case MediaPlayer.Event.ESSelected:
-                if (event.getEsChangedType() == Media.VideoTrack.Type.Video) {
+                if (mService != null && event.getEsChangedType() == Media.VideoTrack.Type.Video) {
                     Media.VideoTrack vt = mService.getCurrentVideoTrack();
                     if (vt != null)
                         mFov = vt.projection == Media.VideoTrack.Projection.Rectangular ? 0f : DEFAULT_FOV;



More information about the Android mailing list