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

Commit 4686d3ef authored by Tom Cherry's avatar Tom Cherry
Browse files

Fix NPE with UsbManager

Not all devices have USB.

Test: no NPE starting the settings app.
Change-Id: I6e0bf5084e4fa225522c4d0d3187730a47058507
parent d1488ece
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -765,7 +765,11 @@ public class Utils {
            return false;
        }

        final List<UsbPort> usbPortList = context.getSystemService(UsbManager.class).getPorts();
        final UsbManager usbManager = context.getSystemService(UsbManager.class);
        if (usbManager == null) {
            return false;
        }
        final List<UsbPort> usbPortList = usbManager.getPorts();
        if (usbPortList == null || usbPortList.isEmpty()) {
            return false;
        }