nodebb crash when read chat message
-
nodebb crash when read chat message, error log as below:
20/5 02:48 [246] - error: TypeError: Cannot read property 'fromuid' of undefined
at /opt/nodebb/src/messaging.js:146:34
at /opt/nodebb/node_modules/async/lib/async.js:249:17
at /opt/nodebb/node_modules/async/lib/async.js:125:13 -
code changes to avoid the crash, but peoples with dirty data can not see chat message from each other.
function(messages, next) { async.map(messages, function(message, next) { if(typeof message === 'undefined') { //changes winston.error('message is undefined.'); }else { winston.info('message=`' + JSON.stringify(message) ); var self = parseInt(message.fromuid, 10) === parseInt(fromuid, 10); message.fromUser = self ? userData[0] : userData[1]; message.toUser = self ? userData[1] : userData[0]; message.timestampISO = utils.toISOString(message.timestamp); message.self = self ? 1 : 0; message.newSet = false; Messaging.parse(message.content, message.fromuid, fromuid, userData[1], userData[0], isNew, function(result) { message.content = result; next(null, message); }); }
Copyright © 2024 NodeBB | Contributors