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

Commit 8f124842 authored by Jeff Brown's avatar Jeff Brown
Browse files

Avoid redundant store into array list.

Prevent possible NPE in case of a race condition
while fetching input devices by descriptor.

Change-Id: I68d0738386c6723d943e595f829981b0890c2b3a
parent afae9d24
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -212,8 +212,10 @@ public final class InputManager {
                } catch (RemoteException ex) {
                    throw new RuntimeException("Could not get input device information.", ex);
                }
            }
                if (inputDevice != null) {
                    mInputDevices.setValueAt(index, inputDevice);
                }
            }
            return inputDevice;
        }
    }
@@ -241,6 +243,8 @@ public final class InputManager {
                        inputDevice = mIm.getInputDevice(id);
                    } catch (RemoteException ex) {
                        // Ignore the problem for the purposes of this method.
                    }
                    if (inputDevice == null) {
                        continue;
                    }
                    mInputDevices.setValueAt(i, inputDevice);