From 9c385214bd23c673dc3b8a8124ca10b9afc6dafe Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 14 Feb 2017 14:47:59 +0900 Subject: [PATCH] [API] Fix bug --- src/api/endpoints/posts/create.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/endpoints/posts/create.js b/src/api/endpoints/posts/create.js index 61f8e714fb..607867403a 100644 --- a/src/api/endpoints/posts/create.js +++ b/src/api/endpoints/posts/create.js @@ -174,6 +174,11 @@ module.exports = (params, user, app) => return rej('poll choices must be an array'); } + // 選択肢が空の配列でエラー + if (poll.choices.length == 0) { + return rej('poll choices is required'); + } + // Validate each choices const shouldReject = poll.choices.some(choice => { if (typeof choice !== 'string') return true;