diff --git a/agents/meshcore.js b/agents/meshcore.js index 804c8733..1d135ac3 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -3723,7 +3723,7 @@ function createMeshCore(agent) { if (x != LastPeriodicServerUpdate) { LastPeriodicServerUpdate = x; mesh.SendCommand(meshCoreObj); } } - function sortObjRec(o) { if (typeof o != 'object') return o; for (var i in o) { if (typeof o[i] == 'object') { o[i] = sortObjRec(o[i]); } } return sortObj(o); } + function sortObjRec(o) { if ((typeof o != 'object') || (Array.isArray(o))) return o; for (var i in o) { if (typeof o[i] == 'object') { o[i] = sortObjRec(o[i]); } } return sortObj(o); } function sortObj(o) { return Object.keys(o).sort().reduce(function (result, key) { result[key] = o[key]; return result; }, {}); } // Starting function diff --git a/meshagent.js b/meshagent.js index cf113534..addef162 100644 --- a/meshagent.js +++ b/meshagent.js @@ -1466,7 +1466,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { if ((command.av != null) && (JSON.stringify(device.av) != JSON.stringify(command.av))) { /*changes.push('AV status');*/ device.av = command.av; change = 1; log = 1; } } - if ((command.users != null) && (device.users != command.users)) { device.users = command.users; change = 1; } // Don't save this to the db. + if ((command.users != null) && (Array.isArray(command.users)) && (device.users != command.users)) { device.users = command.users; change = 1; } // Don't save this to the db. if ((mesh.mtype == 2) && (!args.wanonly)) { // In WAN mode, the hostname of a computer is not important. Don't log hostname changes. if (device.host != obj.remoteaddr) { device.host = obj.remoteaddr; change = 1; changes.push('host'); } diff --git a/views/default.handlebars b/views/default.handlebars index 2936835d..b8fc6590 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -3895,7 +3895,7 @@ } function getUserShortStr(node) { - if (node == null || node.users == null || node.users.length == 0) return ''; + if (node == null || node.users == null || (!Array.isArray(node.users)) || node.users.length == 0) return ''; if (node.users.length > 1) { return '' + nobreak(format("{0} users", node.users.length)) + ''; } var u = node.users[0], su = u, i = u.indexOf('\\'); if (i > 0) { su = u.substring(i + 1); }