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

Commit 64abca79 authored by Jack He's avatar Jack He
Browse files

OPP: Check target device when receiving SDP search result

* Return and print warning message when target is null while
  handling ACTION_SDP_RECORD
* Without this check, a NullPointerException could be triggered
  when a previously successful SDP search result landed on a
  BluetoothOppTransfer object will recently failed SDP search that would
  render mDevice null

Bug: 36260940
Test: make, test sending file through Bluetooth Opp
Change-Id: I861e7e64a7c9b316d4540fd5134892c247753f74
(cherry picked from commit 8e94b07aeccfa09db9add50b116b04393e3d8f1a)
parent 2fc58256
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -149,6 +149,10 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
                    Log.d(TAG, " -> status: " + status);
                    BluetoothDevice device =
                            intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                    if (mDevice == null) {
                        Log.w(TAG, "OPP SDP search, target device is null, ignoring result");
                        return;
                    }
                    if (!device.getAddress().equalsIgnoreCase(mDevice.getAddress())) {
                        Log.w(TAG, " OPP SDP search for wrong device, ignoring!!");
                        return;