Crash when unable to get the fleet member list (still)
Closed this issue · 3 comments
Makeshift commented
/home/user/eve-goons-newwaitlist/eve-goons-waitlist/node_modules/mongodb/lib/utils.js:132
throw err;
^
TypeError: Cannot read property 'length' of null
at module.exports (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/pageContent/publicWaitlist.js:46:63)
at /home/user/eve-goons-newwaitlist/eve-goons-waitlist/template.js:21:7
at sidebar (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/template.js:138:3)
at /home/user/eve-goons-newwaitlist/eve-goons-waitlist/template.js:20:5
at header (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/template.js:43:5)
at generateTemplate (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/template.js:19:3)
at Object.pageGenerate (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/template.js:12:3)
at /home/user/eve-goons-newwaitlist/eve-goons-waitlist/routes.js:30:14
at /home/user/eve-goons-newwaitlist/eve-goons-waitlist/fleets.js:88:4
at args.push (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/node_modules/mongodb/lib/utils.js:404:72)
at handleCallback (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/node_modules/mongodb/lib/utils.js:128:55)
at self.close (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/node_modules/mongodb/lib/cursor.js:934:60)
at handleCallback (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/node_modules/mongodb/lib/utils.js:128:55)
at completeClose (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/node_modules/mongodb/lib/cursor.js:1073:14)
at Cursor.close (/home/user/eve-goons-newwaitlist/eve-goons-waitlist/node_modules/mongodb/lib/cursor.js:1086:10)
at /home/user/eve-goons-newwaitlist/eve-goons-waitlist/node_modules/mongodb/lib/cursor.js:934:21
error: Forever detected script exited with code: 1
Makeshift commented
Also caused by having a null URL for the fleet
Makeshift commented
Sam's fix is a UI fix but it still needs to be validated server side.
lethern commented
fleets.js
module.getMembers
...
}).catch(function (err) {
log.error("fleets.getMembers: Error foresi.characters ", { err, characterID, fleetid });
if (typeof cb === "function") {
cb(null, fleetid, fullDoc);
}
})
where cb == fleets.getMembers(...., function (members)
from routes :: app.post(/commander/)
,
so it is then members==null
moved to
var fleetInfo = {
members: members
which is then later used in template
<td>${payloadContent.fleets[i].members.length}</td>
which throws null exception, as members is null.
Will add
if (members===null)
// log + redirect
instead of creating fleetInfo with empty members