[Android] Benchmark: fix service null reference crash

Duncan McNamara git at videolan.org
Thu May 23 16:52:18 CEST 2019


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu May 23 16:45:07 2019 +0200| [4ea202922fcf89ce19883637380a3e89f2c37df2] | committer: Geoffrey Métais

Benchmark: fix service null reference crash

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt
index 034c8a009..3f40a6acd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt
@@ -314,6 +314,13 @@ class BenchActivity : ShallowVideoPlayer() {
      * At the end of the video buffering, the screenshot callback is set.
      */
     private fun seekScreenshot() {
+        // tmp fix
+        // mService should never be null in this context but it happens
+        if (service == null) {
+            Log.w(TAG, "seekScreenshot: service is null");
+            errorFinish("PlayerService is null");
+            return;
+        }
         if (mProjectionManager != null && mScreenshotCount < mTimestamp!!.size) {
             setTimeout()
             seek(mTimestamp!![mScreenshotCount])



More information about the Android mailing list