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

Commit a91c2236 authored by Erik Wolsheimer's avatar Erik Wolsheimer Committed by android-build-merger
Browse files

Fix potential NPE in BluetoothPairingDialog#onDestroy am: 56c1b61e

am: 116a68e6

Change-Id: I9a96540c9599b19c478e14629e53fa12eb59a8b8
parents 9e63415a 116a68e6
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
    private EditText mPairingView;
    private Button mOkButton;
    private LocalBluetoothProfile mPbapClientProfile;

    private boolean mReceiverRegistered;

    /**
     * Dismiss the dialog if the bond state changes to bonded or none,
@@ -98,8 +98,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
        super.onCreate(savedInstanceState);

        Intent intent = getIntent();
        if (!intent.getAction().equals(BluetoothDevice.ACTION_PAIRING_REQUEST))
        {
        if (!intent.getAction().equals(BluetoothDevice.ACTION_PAIRING_REQUEST)) {
            Log.e(TAG, "Error: this activity may be started only with intent " +
                  BluetoothDevice.ACTION_PAIRING_REQUEST);
            finish();
@@ -167,6 +166,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
         */
        registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_PAIRING_CANCEL));
        registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
        mReceiverRegistered = true;
    }

    private void createUserEntryDialog() {
@@ -373,8 +373,11 @@ public final class BluetoothPairingDialog extends AlertActivity implements
    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mReceiverRegistered) {
            mReceiverRegistered = false;
            unregisterReceiver(mReceiver);
        }
    }

    public void afterTextChanged(Editable s) {
        if (mOkButton != null) {