Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e91d4b29 authored by koh.changseok's avatar koh.changseok Committed by Ajay Panicker
Browse files

AVRCP: Fix unexpected index out of bounds exception

On function checkIndexOutofBounds(),
if endItem value equals to the MediaItem list,
then there will be 'IndexOutOfBoundsException'.
As sub list end value is endItem + 1,
endItem shall be smaller value than list size.

Bug: 64137660
Test: Code compiles
Change-Id: I6d2dc705451cf1f515c8fbfd4ba24ac49dc4271d
(cherry picked from commit 38506165)
parent d5bb9ffd
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -533,7 +533,7 @@ class BrowsedMediaPlayer {
     */
     */
    private List<MediaBrowser.MediaItem> checkIndexOutofBounds(
    private List<MediaBrowser.MediaItem> checkIndexOutofBounds(
            byte[] bdaddr, List<MediaBrowser.MediaItem> children, long startItem, long endItem) {
            byte[] bdaddr, List<MediaBrowser.MediaItem> children, long startItem, long endItem) {
        if (endItem > children.size()) endItem = children.size() - 1;
        if (endItem >= children.size()) endItem = children.size() - 1;
        if (startItem >= Integer.MAX_VALUE) startItem = Integer.MAX_VALUE;
        if (startItem >= Integer.MAX_VALUE) startItem = Integer.MAX_VALUE;
        try {
        try {
            List<MediaBrowser.MediaItem> childrenSubList =
            List<MediaBrowser.MediaItem> childrenSubList =