[Android] Fix ArrayIndexOutOfBoundsException in VideoPlayerActivity

Robert Stone git at videolan.org
Mon Jun 26 07:45:43 UTC 2023


vlc-android | branch: master | Robert Stone <rhstone at gmail.com> | Mon Jun  5 21:10:28 2023 -0700| [3560762f1043539ec7816da14706030a5a925838] | committer: Robert Stone

Fix ArrayIndexOutOfBoundsException in VideoPlayerActivity

> https://code.videolan.org/videolan/vlc-android/commit/3560762f1043539ec7816da14706030a5a925838
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt            | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 595276c635..2798f615b7 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -1512,10 +1512,7 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
             val allTracks= ArrayList<IMedia.Track>()
             service.mediaplayer.media?.let { media ->
                 if (currentTracks?.first == media.uri.toString()) return currentTracks!!.second
-                for (i in 0..media.getAllTracks().size) {
-                    val track = media.getAllTracks()[i]
-                    allTracks.add(track)
-                }
+                allTracks.addAll(media.getAllTracks())
                 currentTracks = Pair(media.uri.toString(), allTracks)
             }
             return allTracks



More information about the Android mailing list