From cdf6ff2a85fe9d782ffbda24a4eb175c5cee4ce1 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Wed, 4 Sep 2013 09:37:05 +0800 Subject: [PATCH] fixed "TypeError: Cannot read property author_id of null" --- controllers/reply.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/reply.js b/controllers/reply.js index 71e47cf..8b0a8eb 100644 --- a/controllers/reply.js +++ b/controllers/reply.js @@ -96,7 +96,7 @@ exports.add_reply2 = function (req, res, next) { if (err) { return next(err); } - if (reply.author_id.toString() !== req.session.user._id.toString()) { + if (reply && reply.author_id.toString() !== req.session.user._id.toString()) { message.sendReply2Message(reply.author_id, req.session.user._id, topic_id, reply._id); } proxy.emit('message_saved');