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

Nicolas Pomepuy git at videolan.org
Thu May 2 13:51:32 CEST 2019


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

Fix crash when initializing with an empty chapter list

> https://code.videolan.org/videolan/vlc-android/commit/98fd95723224e8eadeab6e0cb95b2586320bc0be
---

 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 96c1655cf..f3ec9cc9a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
@@ -309,6 +309,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