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

Commit 2d672873 authored by KalimochoAz's avatar KalimochoAz
Browse files

Avoid Segment fault on null pointer for USBObserver

Change-Id: I924930bfbe2cef711b08e946bcbbc0b572cafe66
parent 5d6f0e87
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ class UsbObserver extends UEventObserver {

        try {
            File[] files = new File(USB_COMPOSITE_CLASS_PATH).listFiles();
            if (files != null) {
                for (int i = 0; i < files.length; i++) {
                    File file = new File(files[i], "enable");
                    FileReader reader = new FileReader(file);
@@ -156,6 +157,9 @@ class UsbObserver extends UEventObserver {
                        mDisabledFunctions.add(functionName);
                    }
                }
            } else {
                Slog.w(TAG, "This kernel has not enabled USB composite class support");
            }
        } catch (FileNotFoundException e) {
            Slog.w(TAG, "This kernel does not have USB composite class support");
        } catch (Exception e) {