fix connectivity crashing serverstats #7003

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed May 1, 2025 at 13:45 UTC 9699e9b4573ff97e415dbbb0aa60684655b3de6f
2 files changed +4 -2
meshcentral.js
+2 -1
@@ -2095,7 +2095,8 @@ function CreateMeshCentralServer(config, args) {
2095 for (var i in obj.mpsserver.ciraConnections) { data.conn.amc += obj.mpsserver.ciraConnections[i].length; }
2096 }
2097 for (var i in obj.connectivityByNode) {
2098 - if (obj.connectivityByNode[i].connectivity == 4) { data.conn.am++; }
2098 + const node = parent.parent.connectivityByNode[i];
2099 + if (node && typeof node.connectivity !== 'undefined' && node.connectivity === 4) { data.conn.am++; }
2100 }
2101 if (obj.firstStats === true) { delete obj.firstStats; data.first = true; }
2102 if (obj.multiServer != null) { data.s = obj.multiServer.serverid; }
meshuser.js
+2 -1
@@ -512,7 +512,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
512 for (var i in parent.parent.mpsserver.ciraConnections) { serverStats.ConnectedIntelAMTCira += parent.parent.mpsserver.ciraConnections[i].length; }
513 }
514 for (var i in parent.parent.connectivityByNode) {
515 - if (parent.parent.connectivityByNode[i].connectivity == 4) { serverStats.ConnectedIntelAMT++; }
515 + const node = parent.parent.connectivityByNode[i];
516 + if (node && typeof node.connectivity !== 'undefined' && node.connectivity === 4) { serverStats.ConnectedIntelAMT++; }
517 }
518
519 // Take a look at agent errors