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

Commit fdcffc5c authored by Ray Kuo's avatar Ray Kuo
Browse files

OPP: Fix the NPE in OPP service when stop() is called before start().

Due to start() is not called, mNotifier is not initialized then
mNotifier.cancelNotifications() causes NPE when handling the
STOP_LISTENER message. In the stop(), add a check of the
sBluetoothOppService has been initialized before sending the STOP_LISTENER
message.

Bug: 132860582
Test: make, force not handling start() and perform Bluetooth/Airplane mode
on/off tests.

Change-Id: Ieef1a65455b03a065b1a3c3dac0a5c9e3dd0bb09
parent 152b200f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -243,6 +243,10 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti

    @Override
    public boolean stop() {
        if (sBluetoothOppService == null) {
            Log.w(TAG, "stop() called before start()");
            return true;
        }
        setBluetoothOppService(null);
        mHandler.sendMessage(mHandler.obtainMessage(STOP_LISTENER));
        return true;