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

Commit 7b64c56c authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by Ajay Panicker
Browse files

Add a missing check for null pointer during closing of PBAP Service

This fixes NullPointerException when processing MSG_SERVERSESSION_CLOSE
from the Obex Server if Bluetooth itself is shutting down.

BluetoothPbapService.closeService() ->
BluetoothPbapObexServer.onClose() -> msg(MSG_SERVERSESSION_CLOSE) -> ...
-> BluetoothPbapService.stopObexServerSession()
-> mAdapter.isEnabled() -> NPE (mAdapter is null)

Bug: 62073087
Test: Code compilation
Change-Id: Ica98e1b784b3a51456c7709062074ea122eb8bdd
parent 79ba291e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -502,7 +502,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect

        // Last obex transaction is finished, we start to listen for incoming
        // connection again
        if (mAdapter.isEnabled()) {
        if (mAdapter != null && mAdapter.isEnabled()) {
            startSocketListeners();
        }
        setState(BluetoothPbap.STATE_DISCONNECTED);