diff --git a/www/common/outer/userObject.js b/www/common/outer/userObject.js index e67dd5f01..1f8b73da9 100644 --- a/www/common/outer/userObject.js +++ b/www/common/outer/userObject.js @@ -626,6 +626,11 @@ define([ var toClean = []; for (var id in fd) { id = Number(id); + if (!id && id !== 0) { + debug("Invalid file ID in filesData.", id); + toClean.push(id); + continue; + } var el = fd[id]; // Clean corrupted data diff --git a/www/common/proxy-manager.js b/www/common/proxy-manager.js index 017a403bb..8bbf641f6 100644 --- a/www/common/proxy-manager.js +++ b/www/common/proxy-manager.js @@ -729,6 +729,7 @@ define([ if (type === "pin") { return function (fileId) { var data = userObject.getFileData(fileId); + if (!data) { return; } // Don't pin pads owned by someone else if (_ownedByOther(Env, data.owners)) { return; } // Don't push duplicates diff --git a/www/common/userObject.js b/www/common/userObject.js index a9068afe6..f39e80aee 100644 --- a/www/common/userObject.js +++ b/www/common/userObject.js @@ -311,12 +311,12 @@ define([ _getFiles[FILES_DATA] = function () { var ret = []; if (!files[FILES_DATA]) { return ret; } - return Object.keys(files[FILES_DATA]).map(Number); + return Object.keys(files[FILES_DATA]).map(Number).filter(Boolean); }; _getFiles[SHARED_FOLDERS] = function () { var ret = []; if (!files[SHARED_FOLDERS]) { return ret; } - return Object.keys(files[SHARED_FOLDERS]).map(Number); + return Object.keys(files[SHARED_FOLDERS]).map(Number).filter(Boolean); }; var getFiles = exp.getFiles = function (categories) { var ret = [];