Fixed rare server exception.

Ylian Saint-Hilaire committed Dec 6, 2020 at 22:24 UTC a4d63e713d44b277001a0b044d4cf44d6a5692fe
1 file changed +1
meshagent.js
+1
@@ -261,6 +261,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
261 obj.agentUpdate.buf[2] = 0;
262 obj.agentUpdate.buf[3] = 1;
263 parent.fs.read(obj.agentUpdate.fd, obj.agentUpdate.buf, 4, parent.parent.agentUpdateBlockSize, obj.agentUpdate.ptr, function (err, bytesRead, buffer) {
264 + if (obj.agentUpdate == null) return;
265 if ((err != null) || (bytesRead == 0)) {
266 // Error reading the agent file, stop here.
267 try { parent.fs.close(obj.agentUpdate.fd); } catch (ex) { }