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

Commit 5a9b46be authored by Michael W's avatar Michael W Committed by Jochen Sprickerhof
Browse files

Calendar: Prevent NPE

* File.list() can return null (i.e. due to an I/O error) resulting in a
  NPE when trying to get the length
* Fix logic to prevent this
* No single-line statement due to the still possible I/O error if calling
  list() twice

BUGBASH-91
Change-Id: Ieeb92a592031315030c5d7aaf4a99b61b345df1d
(cherry picked from commit 7315b87c3b03b1e2198d614ddce140a0901564cb)
(cherry picked from commit bc4acc4)
parent ef437265
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ public class ImportActivity extends Activity {

    public static boolean hasThingsToImport(Context context) {
        File folder = EventInfoFragment.EXPORT_SDCARD_DIRECTORY;
        return folder.exists() && folder.list().length > 0;
        String[] filesAndFolders = folder.list();
        return filesAndFolders != null && filesAndFolders.length > 0;
    }

}