From c5d5f7cef39eec27db34ac9ff2cb6db25bbab206 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 1 Nov 2017 04:28:53 +0900 Subject: [PATCH] Fix bug --- src/api/endpoints/posts/create.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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: {