guard against null elements in the drive

pull/1/head
ansuz 6 years ago
parent e728b5aeeb
commit 8be6c84e2f

@ -506,8 +506,14 @@ define([
var fixRoot = function (elem) { var fixRoot = function (elem) {
if (typeof(files[ROOT]) !== "object") { debug("ROOT was not an object"); files[ROOT] = {}; } if (typeof(files[ROOT]) !== "object") { debug("ROOT was not an object"); files[ROOT] = {}; }
var element = elem || files[ROOT]; var element = elem || files[ROOT];
if (!element) { return console.error("Invalid element in root");
var nbMetadataFolders = 0; var nbMetadataFolders = 0;
for (var el in element) { for (var el in element) {
if (element[el] === null) {
console.error('element[%s] is null', el);
delete element[el];
continue;
}
if (exp.isFolderData(element[el])) { if (exp.isFolderData(element[el])) {
if (nbMetadataFolders !== 0) { if (nbMetadataFolders !== 0) {
debug("Multiple metadata files in folder"); debug("Multiple metadata files in folder");

Loading…
Cancel
Save