CB-14181: (android) Fix bug - Cannot read property 'filesystemName' of null (#235)
CB-14181: (android) fix: Cannot read property 'filesystemName' of null
fix error :
Error in Success callbackId: File1539060614 : TypeError: Cannot read property 'filesystemName' of null
cordova.js:314 Uncaught TypeError: Cannot read property 'filesystemName' of null
The `fsRoot` might be null. reproduced with latest cordova on android emulator.
* fix: eslint
diff --git a/www/fileSystems-roots.js b/www/fileSystems-roots.js
index 9a3fc7a..b15adbd 100644
--- a/www/fileSystems-roots.js
+++ b/www/fileSystems-roots.js
@@ -30,8 +30,10 @@
fsMap = {};
for (var i = 0; i < response.length; ++i) {
var fsRoot = response[i];
- var fs = new FileSystem(fsRoot.filesystemName, fsRoot);
- fsMap[fs.name] = fs;
+ if (fsRoot) {
+ var fs = new FileSystem(fsRoot.filesystemName, fsRoot);
+ fsMap[fs.name] = fs;
+ }
}
callback(fsMap[name]);
}