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

Commit 9f87fe77 authored by Hui Peng's avatar Hui Peng
Browse files

Fix a null-ptr-deref bug in BondStateMachine

Bug: 293816194
Test: Existing tests pass
Change-Id: I838efbedd190a2451980746edb7b7f95aa57f0d2
parent efde2785
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -250,6 +250,11 @@ final class BondStateMachine extends StateMachine {
                    }
                    }
                    break;
                    break;
                case SSP_REQUEST:
                case SSP_REQUEST:
                    if (devProp == null) {
                        errorLog("devProp is null, maybe the device is disconnected");
                        break;
                    }

                    int passkey = msg.arg1;
                    int passkey = msg.arg1;
                    int variant = msg.arg2;
                    int variant = msg.arg2;
                    boolean displayPasskey =
                    boolean displayPasskey =
@@ -262,6 +267,11 @@ final class BondStateMachine extends StateMachine {
                            variant);
                            variant);
                    break;
                    break;
                case PIN_REQUEST:
                case PIN_REQUEST:
                    if (devProp == null) {
                        errorLog("devProp is null, maybe the device is disconnected");
                        break;
                    }

                    BluetoothClass btClass = dev.getBluetoothClass();
                    BluetoothClass btClass = dev.getBluetoothClass();
                    int btDeviceClass = btClass.getDeviceClass();
                    int btDeviceClass = btClass.getDeviceClass();
                    if (btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD || btDeviceClass
                    if (btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD || btDeviceClass