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

Commit f9077047 authored by Ajay Panicker's avatar Ajay Panicker Committed by android-build-merger
Browse files

Fix IndexOutOfBounds exception due to incorrect media player start index

am: b50a7964

Change-Id: Ibf4cac19ba701eb4af7ee475abd1a6aad7c3b7d4
parents 7798d2e6 b50a7964
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2053,12 +2053,12 @@ public final class Avrcp {
            short[] featureBitMaskValues =
                    new short[numPlayers * AvrcpConstants.AVRC_FEATURE_MASK_SIZE];

            // Reserve the first spot for the currently addressed player
            int players = 1;
            // Reserve the first spot for the currently addressed player if
            // we have one
            int players = mMediaPlayerInfoList.containsKey(mCurrAddrPlayerID) ? 1 : 0;
            for (Map.Entry<Integer, MediaPlayerInfo> entry : mMediaPlayerInfoList.entrySet()) {
                int idx = players;
                if (entry.getKey() == mCurrAddrPlayerID || mMediaPlayerInfoList.size() == 1)
                    idx = 0;
                if (entry.getKey() == mCurrAddrPlayerID) idx = 0;
                MediaPlayerInfo info = entry.getValue();
                playerIds[idx] = entry.getKey();
                playerTypes[idx] = info.getMajorType();