[Android] Fix crash when initializing with an empty chapter list

Nicolas Pomepuy git at videolan.org
Thu May 2 15:15:50 CEST 2019


vlc-android | branch: 3.1.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Thu May  2 07:48:44 2019 +0200| [9558739e339316bbd2caebd466bc4fca92df1418] | committer: Geoffrey Métais

Fix crash when initializing with an empty chapter list

(cherry picked from commit 98fd95723224e8eadeab6e0cb95b2586320bc0be)

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

 vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
index ca5055656..170044d9d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
@@ -310,6 +310,7 @@ class PlayerOptionsDelegate(val activity: AppCompatActivity, val service: Playba
 
     private fun initChapters(binding: PlayerOptionItemBinding) {
         val chapters = service.getChapters(-1) ?: return
+        if (chapters.isEmpty()) return
         val index = service.chapterIdx
         if (chapters[index].name.isNullOrEmpty())
             binding.optionTitle.text = String.format("%s %d", res.getString(R.string.chapter), index)



More information about the Android mailing list