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

Commit e5029e78 authored by Wei Wang's avatar Wei Wang
Browse files

Add protection before cleaning up adv and scan manager.

b/16845251

Apparently for GattService stop and cleanup could be called before start
is even called.

Change-Id: Id0ac2e68da504f79160264012a0cdf5127eccfc7
parent 3cfcead9
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -187,16 +187,16 @@ public class GattService extends ProfileService {
        mHandleMap.clear();
        mServiceDeclarations.clear();
        mReliableQueue.clear();
        mAdvertiseManager.cleanup();
        mScanManager.cleanup();
        if (mAdvertiseManager != null) mAdvertiseManager.cleanup();
        if (mScanManager != null) mScanManager.cleanup();
        return true;
    }

    protected boolean cleanup() {
        if (DBG) Log.d(TAG, "cleanup()");
        cleanupNative();
        mAdvertiseManager.cleanup();
        mScanManager.cleanup();
        if (mAdvertiseManager != null) mAdvertiseManager.cleanup();
        if (mScanManager != null) mScanManager.cleanup();
        return true;
    }