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

Commit 6fa4a634 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
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
(cherry picked from commit d5a30661a5c51e5f02320868ec870709c1c0ecac)
parent ba2a06a0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -505,7 +505,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);