[Android] Medialibrary: Avoid double init

Geoffrey Métais git at videolan.org
Thu Dec 19 09:17:42 CET 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 18 10:55:14 2019 +0000| [0f46c2ee97056806e1a5c76340dc4ad22a1a3a02] | committer: Geoffrey Métais

Medialibrary: Avoid double init


(cherry picked from commit b1c99f29a3dcb8f0c21bac1195f2ab584437482c)

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

 vlc-android/src/org/videolan/vlc/MediaParsingService.kt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index 0275d4e35..eb3ea606b 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -421,6 +421,10 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope, Lifec
                 medialibrary.discover(action.path)
             }
             is Init -> {
+                if (medialibrary.isInitiated) {
+                    exitCommand()
+                    return at actor
+                }
                 val context = this at MediaParsingService
                 var shouldInit = !dbExists()
                 val initCode = medialibrary.init(context)



More information about the Android mailing list