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

Commit b6a1953f authored by Robert Wu's avatar Robert Wu
Browse files

USB MIDI: Add null check on device removal

In I0b86f9bd26e4c9a50576f704deb6b53fc9a5c130,
we introduced a bug by forgetting a null check.
This CL adds the null check back.

Bug: 223481435
Change-Id: I62e9b1135306b2d952f7fddace656a938545e74f
Test: MidiKeyboard/MidiScope
parent 11d05992
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -496,12 +496,14 @@ public class UsbHostManager {
                // MIDI
                ArrayList<UsbDirectMidiDevice> midiDevices =
                        mMidiDevices.remove(deviceAddress);
                if (midiDevices != null) {
                    for (UsbDirectMidiDevice midiDevice : midiDevices) {
                        if (midiDevice != null) {
                        Slog.i(TAG, "USB MIDI Device Removed: " + deviceAddress);
                            IoUtils.closeQuietly(midiDevice);
                        }
                    }
                    Slog.i(TAG, "USB MIDI Devices Removed: " + deviceAddress);
                }

                getCurrentUserSettings().usbDeviceRemoved(device);
                ConnectionRecord current = mConnected.get(deviceAddress);