From f90583abbfab27bb6f8b2699e9d951aa4b3a7819 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Mon, 19 Mar 2018 11:19:39 +0100 Subject: [PATCH] [android] - verify optional before accessing it --- platform/android/src/file_source.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp index 612619a30b0..d8d715dbd3b 100644 --- a/platform/android/src/file_source.cpp +++ b/platform/android/src/file_source.cpp @@ -70,14 +70,16 @@ void FileSource::resume(jni::JNIEnv&) { activationCounter.value()++; if (activationCounter == 1) { - fileSource->resume(); + fileSource->resume(); } } void FileSource::pause(jni::JNIEnv&) { - activationCounter.value()--; - if (activationCounter == 0) { - fileSource->pause(); + if (activationCounter) { + activationCounter.value()--; + if (activationCounter == 0) { + fileSource->pause(); + } } }