diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index 34265dcbc3..2e9f1d90fb 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -228,11 +228,13 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { // ----------------------------------------------------------- // Post processes - Channel.update({ _id: channel._id }, { - $inc: { - index: 1 - } - }); + if (channel) { + Channel.update({ _id: channel._id }, { + $inc: { + index: 1 + } + }); + } User.update({ _id: user._id }, { $set: {