Skip to content

Node.js based forum software built for the modern web

make sure post exists before edit

barisusaklif88d822fe221
diff --git a/src/posts/edit.js b/src/posts/edit.js
index 27f13a25e2..2eca8a8328 100644
--- a/src/posts/edit.js
+++ b/src/posts/edit.js
@@ -34,6 +34,9 @@ module.exports = function(Posts) {
Posts.getPostData(data.pid, next);
},
function (_postData, next) {
+ if (!_postData) {
+ return next(new Error('[[error:no-post]]'));
+ }
postData = _postData;
postData.content = data.content;
postData.edited = now;