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

Commit 5d04f1c9 authored by Zhihai Xu's avatar Zhihai Xu
Browse files

NPE in BluetoothDevice.fetchUuidsWithSdp

This is caused by access fetchUuidsWithSdp after bluetooth is turned off.
We can add check null pointer for sService,
before call sService.fetchRemoteUuids(this) to fix this problem;

bug:12533948
Change-Id: Id2cab92a56185073fabcabcfb21a243e99a60cee
parent 7acec30a
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -947,8 +947,13 @@ public final class BluetoothDevice implements Parcelable {
      *               was started.
      *               was started.
      */
      */
     public boolean fetchUuidsWithSdp() {
     public boolean fetchUuidsWithSdp() {
        IBluetooth service = sService;
        if (service == null) {
            Log.e(TAG, "BT not enabled. Cannot fetchUuidsWithSdp");
            return false;
        }
        try {
        try {
            return sService.fetchRemoteUuids(this);
            return service.fetchRemoteUuids(this);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        } catch (RemoteException e) {Log.e(TAG, "", e);}
            return false;
            return false;
    }
    }