[Android] Prevent NPE in Video player

Geoffrey Métais git at videolan.org
Tue Oct 10 14:01:36 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct 10 14:01:10 2017 +0200| [c4e75f7733a0ef93b6ecec07d14ee5d07830978a] | committer: Geoffrey Métais

Prevent NPE in Video player

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java        | 7 +++++--
 1 file changed, 5 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 62a0e2d7f..dbcea290a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2726,8 +2726,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 if (time > mForcedTime)
                     mLastTime = mForcedTime = -1;
             }
-        } else if (time == 0)
-            time = (int) mService.getCurrentMediaWrapper().getTime();
+        } else if (time == 0) {
+            final MediaWrapper mw = mService.getCurrentMediaWrapper();
+            if (mw != null)
+                time = (int) mw.getTime();
+        }
         return mForcedTime == -1 ? time : mForcedTime;
     }
 



More information about the Android mailing list