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

Commit fdc5ac4c authored by Andrew Sapperstein's avatar Andrew Sapperstein
Browse files

Null check file.list() results.

If there are no files in "vendor/overlay", file.list() returns
null.

Test: manual
Change-Id: I65d0c5fae3293804efa1c18d02d640f1f95c2015
Fixes: 32832139
parent de45ca5e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -40,12 +40,13 @@ public class ThemePreference extends ListPreference {
    @Override
    public void onAttached() {
        super.onAttached();
        File file = new File("/vendor/overlay");
        ArrayList<String> options = Lists.newArrayList(file.list());
        String def = SystemProperties.get("ro.boot.vendor.overlay.theme");
        if (TextUtils.isEmpty(def)) {
            def = getContext().getString(R.string.default_theme);
        }
        String[] fileList = new File("/vendor/overlay").list();
        ArrayList<String> options = fileList != null
                ? Lists.newArrayList(fileList) : new ArrayList<>();
        if (!options.contains(def)) {
            options.add(0, def);
        }