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

Commit 12d8a0d7 authored by Juffin Alex Varghese's avatar Juffin Alex Varghese Committed by Pradeep Panigrahi
Browse files

Bluetooth-OPP: Avoid IndexOutOfBoundsException if share is zero

This change will avoid IndexOutOfBoundsException if number of sharing
files are zero. Otherwise, Bluetooth application will force close itself
when exception encountered.

Change-Id: I42473c8ca2d9116c6d57707ab8f3c452d7027e67
parent 617b708e
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -470,6 +470,7 @@ public class BluetoothOppService extends Service {
                        // We're beyond the end of the cursor but there's still
                        // some
                        // stuff in the local array, which can only be junk
                        if (mShares.size() != 0)
                            if (V) Log.v(TAG, "Array update: trimming " +
                                mShares.get(arrayPos).mId + " @ " + arrayPos);

@@ -497,7 +498,9 @@ public class BluetoothOppService extends Service {
                            cursor.moveToNext();
                            isAfterLast = cursor.isAfterLast();
                        } else {
                            int arrayId = mShares.get(arrayPos).mId;
                            int arrayId = 0;
                            if (mShares.size() != 0)
                                arrayId = mShares.get(arrayPos).mId;

                            if (arrayId < id) {
                                if (V) Log.v(TAG, "Array update: removing " + arrayId + " @ "