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

Commit ce52d7f8 authored by Ashwini Munigala's avatar Ashwini Munigala Committed by Andre Eisenbach
Browse files

MAP: Handle possible NPE while disconnect map.

Precondition:
Verified with IOT: MecApp in MCE role

UseCase:
1. Connect MAS
2. Register Mas Instance via MNS
3. Disconnect MAS

Failure:
Bluetooth App crash sometimes when disconnect map profile.

Root Cause:
The issue is hit when MAS disconnect is finished before MNS unregister.
In this case NullpointerException is happening because of clearing
BluetoothMapContentObserver already as a part of cleanup.

Fix:
Handle Null pointer exception while last
MAS instance disconnect is handled before MNS
unregistration.

Change-Id: I4e72038a5ddc6c3ac8c515def57cb4f98fe87675
parent 95560639
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -405,7 +405,7 @@ public class BluetoothMapService extends ProfileService {
                    if (DEBUG) Log.d(TAG,"ContentObserver Registration MASID: " + msg.arg1
                        + " Enable: " + msg.arg2);
                    BluetoothMapMasInstance masInst = mMasInstances.get(msg.arg1);
                    if (masInst != null) {
                    if (masInst != null && masInst.mObserver != null) {
                        try {
                            if (msg.arg2 == BluetoothMapAppParams.NOTIFICATION_STATUS_YES) {
                                masInst.mObserver.registerObserver();