File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
android/capacitor/src/main/java/com/getcapacitor/plugin Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -412,10 +412,13 @@ public void readdir(PluginCall call) {
412
412
|| isStoragePermissionGranted (PluginRequestCodes .FILESYSTEM_REQUEST_READ_FOLDER_PERMISSIONS , Manifest .permission .READ_EXTERNAL_STORAGE )) {
413
413
if (fileObject != null && fileObject .exists ()) {
414
414
String [] files = fileObject .list ();
415
-
416
- JSObject ret = new JSObject ();
417
- ret .put ("files" , JSArray .from (files ));
418
- call .success (ret );
415
+ if (files != null ) {
416
+ JSObject ret = new JSObject ();
417
+ ret .put ("files" , JSArray .from (files ));
418
+ call .success (ret );
419
+ } else {
420
+ call .error ("Unable to read directory" );
421
+ }
419
422
} else {
420
423
call .error ("Directory does not exist" );
421
424
}
You can’t perform that action at this time.
0 commit comments