Skip to content

Node.js based forum software built for the modern web

modules fixes

Baris Soner Usaklie884ff1f59b1
diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js
index f871ea7c70..22d8458e23 100644
--- a/src/socket.io/modules.js
+++ b/src/socket.io/modules.js
@@ -33,7 +33,11 @@ SocketModules.composer.push = function(socket, pid, callback) {
});
}
], function(err, results) {
- callback(err, {
+ if(err) {
+ return callback(err);
+ }
+
+ callback(null, {
title: results[1],
pid: pid,
body: results[0].content
@@ -64,11 +68,17 @@ SocketModules.composer.editCheck = function(socket, pid, callback) {
SocketModules.chats = {};
SocketModules.chats.get = function(socket, data, callback) {
- var touid = data.touid;
- Messaging.getMessages(socket.uid, touid, callback);
+ if(!data) {
+ return callback(new Error('invalid data'));
+ }
+
+ Messaging.getMessages(socket.uid, data.touid, callback);
};
SocketModules.chats.send = function(socket, data) {
+ if(!data) {
+ return callback(new Error('invalid data'));
+ }
var touid = data.touid;
if (touid === socket.uid || socket.uid === 0) {