Skip to content

Commit

Permalink
fix: don't crash if content is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Jul 22, 2020
1 parent 5a5abf3 commit 4658121
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/socket.io/index.js
Expand Up @@ -150,6 +150,7 @@ async function onMessage(socket, payload) {
});
}
} catch (err) {
winston.error(err.stack ? err.stack : err.message);
callback({ message: err.message });
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/socket.io/posts.js
Expand Up @@ -178,7 +178,10 @@ SocketPosts.editQueuedContent = async function (socket, data) {
throw new Error('[[error:invalid-data]]');
}
await posts.editQueuedContent(socket.uid, data.id, data.content, data.title);
return await plugins.fireHook('filter:parse.post', { postData: data });
if (data.content) {
return await plugins.fireHook('filter:parse.post', { postData: data });
}
return { postData: data };
};

require('../promisify')(SocketPosts);

0 comments on commit 4658121

Please sign in to comment.