From 7b364d48b06573f463ebeddd9bc87c8461bbfa56 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 23 May 2022 11:24:28 -0700 Subject: [PATCH] Fixed server exception, #4030 --- meshuser.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/meshuser.js b/meshuser.js index 7f5bbb34..7088745f 100644 --- a/meshuser.js +++ b/meshuser.js @@ -7274,10 +7274,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use function readFilesRec(path) { var r = {}, dir = fs.readdirSync(path); for (var i in dir) { - var f = { t: 3, d: 111 }; - var stat = fs.statSync(path + '/' + dir[i]); - if ((stat.mode & 0x004000) == 0) { f.s = stat.size; f.d = stat.mtime.getTime(); } else { f.t = 2; f.f = readFilesRec(path + '/' + dir[i]); } - r[dir[i]] = f; + var f = { t: 3, d: 111 }, stat = null; + try { stat = fs.statSync(path + '/' + dir[i]); } catch (ex) { } + if (stat != null) { + if ((stat.mode & 0x004000) == 0) { f.s = stat.size; f.d = stat.mtime.getTime(); } else { f.t = 2; f.f = readFilesRec(path + '/' + dir[i]); } + r[dir[i]] = f; + } } return r; }