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

Commit 8274a481 authored by Ajay Kumar's avatar Ajay Kumar Committed by Gerrit - the friendly Code Review server
Browse files

Bluetooth: Handling Null profile references before connect

Handling the Null references of profiles before connecting.

Change-Id: I52a991eedd4c25381c67eec570a774a94fe0d6b7
parent 426e875c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -262,11 +262,15 @@ public class BluetoothControllerImpl implements BluetoothController {
            final int profile = profiles.keyAt(i);
            if (mProfiles.indexOfKey(profile) >= 0) {
                final Profile p = BluetoothUtil.getProfile(mProfiles.get(profile));
                if (p == null) {
                    Log.e(TAG, "Unable to get Profile for " + profileToString(profile));
                } else {
                    final boolean ok = connect ? p.connect(device) : p.disconnect(device);
                if (DEBUG) Log.d(TAG, action + " " + profileToString(profile) + " "
                        + (ok ? "succeeded" : "failed"));
                }
            } else {
                Log.w(TAG, "Unable get get Profile for " + profileToString(profile));
                Log.e(TAG, "Unable to get Profile for " + profileToString(profile));
            }
        }
    }