Fix mesh agent disconnection issue

Ylian Saint-Hilaire committed Apr 13, 2018 at 12:28 UTC a122ba6e33dd31678f6a41f1ae7ffad985b5cd49
1 file changed +1 -1
meshagent.js
+1 -1
@@ -48,7 +48,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
48 // Other clean up may be needed here
49 if (obj.unauth) { delete obj.unauth; }
50 if (obj.agentUpdate != null) { obj.fs.close(obj.agentUpdate.fd); obj.agentUpdate = null; }
51 - if (obj.agentInfo.capabilities & 0x20) { // This is a temporary agent, remote it
51 + if ((obj.agentInfo) && (obj.agentInfo.capabilities) && (obj.agentInfo.capabilities & 0x20)) { // This is a temporary agent, remote it
52 // Delete this node including network interface information and events
53 obj.db.Remove(obj.dbNodeKey); // Remove node with that id
54 obj.db.Remove('if' + obj.dbNodeKey); // Remove interface information