[Android] Benchmark: fix mService null reference crash

Duncan McNamara git at videolan.org
Thu May 23 16:27:26 CEST 2019


vlc-android | branch: 3.1.x | Duncan McNamara <dcn.mcnamara at gmail.com> | Tue Apr  9 14:16:38 2019 +0200| [028ffea4734a77946c804a85d0aeed6b9063ea20] | committer: Geoffrey Métais

Benchmark: fix mService null reference crash

Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

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

 .../src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java    | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
index 4f2575668..b72260f7d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
@@ -358,6 +358,13 @@ public class BenchActivity extends ShallowVideoPlayer {
     private void seekScreenshot() {
         if (mProjectionManager != null && mScreenshotCount < mTimestamp.size()) {
             setTimeout();
+            // tmp fix
+            // mService should never be null in this context but it happens
+            if (mService == null) {
+                Log.w(TAG, "seekScreenshot: mService is null");
+                errorFinish("PlayerService is null");
+                return;
+            }
             seek(mTimestamp.get(mScreenshotCount));
             ++mScreenshotCount;
             mSeeking = true;



More information about the Android mailing list