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

Commit 42ec73bc authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

CsipSetCoordinatorService: Fix possible null ptr dereference

Bug: 364916949
Flag: Exempt, trivial fix
Test: mmm packages/modules/Bluetooth
Change-Id: Ie89a03b2131521bbf1674d48a866c523ec7d71a7
parent a8eeda6c
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -911,6 +911,16 @@ public class CsipSetCoordinatorService extends ProfileService {

    /** Process a change in the bonding state for a device */
    public void handleBondStateChanged(BluetoothDevice device, int fromState, int toState) {
        if (mHandler == null) {
            Log.e(
                    TAG,
                    "mHandler is null, service is stopped. Ignore Bond State for "
                            + device
                            + " to state: "
                            + toState);
            return;
        }

        mHandler.post(() -> bondStateChanged(device, toState));
    }

@@ -972,6 +982,15 @@ public class CsipSetCoordinatorService extends ProfileService {
    }

    void handleConnectionStateChanged(BluetoothDevice device, int fromState, int toState) {
        if (mHandler == null) {
            Log.e(
                    TAG,
                    "mHandler is null, service is stopped. Ignore Connection State for "
                            + device
                            + " to state: "
                            + toState);
            return;
        }
        mHandler.post(() -> connectionStateChanged(device, fromState, toState));
    }