Skip to content

Commit

Permalink
fix(android): Prevent Android 10 crash on Filesystem.readdir (#2950)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored May 19, 2020
1 parent b8e7279 commit 0914c23
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,13 @@ public void readdir(PluginCall call) {
|| isStoragePermissionGranted(PluginRequestCodes.FILESYSTEM_REQUEST_READ_FOLDER_PERMISSIONS, Manifest.permission.READ_EXTERNAL_STORAGE)) {
if (fileObject != null && fileObject.exists()) {
String[] files = fileObject.list();

JSObject ret = new JSObject();
ret.put("files", JSArray.from(files));
call.success(ret);
if (files != null) {
JSObject ret = new JSObject();
ret.put("files", JSArray.from(files));
call.success(ret);
} else {
call.error("Unable to read directory");
}
} else {
call.error("Directory does not exist");
}
Expand Down

0 comments on commit 0914c23

Please sign in to comment.