From 43ca61de8c6b278a32127ad191a8f37a8989466e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 1 Sep 2014 14:42:11 -0400 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 831a6aa303..563b3edae4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # NodeBB [![Build Status](https://travis-ci.org/NodeBB/NodeBB.svg?branch=master)](https://travis-ci.org/NodeBB/NodeBB) [![Dependency Status](https://david-dm.org/nodebb/nodebb.svg)](https://david-dm.org/nodebb/nodebb) -[![Code Climate](https://codeclimate.com/github/designcreateplay/NodeBB.png)](https://codeclimate.com/github/designcreateplay/NodeBB) +[![Code Climate](https://codeclimate.com/github/NodeBB/NodeBB/badges/gpa.svg)](https://codeclimate.com/github/NodeBB/NodeBB) [![Documentation Status](https://readthedocs.org/projects/nodebb/badge/?version=latest)](https://readthedocs.org/projects/nodebb/?badge=latest) **NodeBB Forum Software** is powered by Node.js and built on a Redis database. It utilizes web sockets for instant interactions and real-time notifications. NodeBB is compatible down to IE8 and has many modern features out of the box such as social network integration and streaming discussions. From 0b79a737324a398de15976d258b27cf4597b9d29 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 1 Sep 2014 17:24:18 -0400 Subject: [PATCH 2/2] crash fix if composer is opened in a topic that was deleted/purged --- src/socket.io/modules.js | 4 ++++ src/topics/posts.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js index 45fde242dd..1156b1c379 100644 --- a/src/socket.io/modules.js +++ b/src/socket.io/modules.js @@ -71,6 +71,10 @@ SocketModules.composer.push = function(socket, pid, callback) { return callback(err); } + if (!results.topic) { + return callback(new Error('[[error:no-topic]]')); + } + callback(null, { pid: pid, body: postData.content, diff --git a/src/topics/posts.js b/src/topics/posts.js index 98c712341a..b6dc910005 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -248,6 +248,9 @@ module.exports = function(Topics) { Topics.getTopicDataByPid = function(pid, callback) { posts.getPostField(pid, 'tid', function(err, tid) { + if (err) { + return callback(err); + } Topics.getTopicData(tid, callback); }); };