From e1cfe7536c1817c5b481df8369a8975884a02e1a Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 15 Jun 2016 12:54:52 +0800 Subject: [PATCH] FIX: Add default values when no value has been selected. --- .../assets/javascripts/controllers/poll-ui-builder.js.es6 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 index ce139cd4597..b8fa691cd87 100644 --- a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 +++ b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 @@ -70,12 +70,12 @@ export default Ember.Controller.extend({ @computed("isMultiple", "isNumber", "pollOptionsCount", "pollMin", "pollStep") pollMaxOptions(isMultiple, isNumber, count, pollMin, pollStep) { if (!isMultiple && !isNumber) return; - const pollMinInt = parseInt(pollMin); + const pollMinInt = parseInt(pollMin) || 1; if (isMultiple) { return this._comboboxOptions(pollMinInt + 1, count + 1); } else if (isNumber) { - const pollStepInt = parseInt(pollStep); + const pollStepInt = parseInt(pollStep) || 1; return this._comboboxOptions(pollMinInt + 1, pollMinInt + (this.siteSettings.poll_maximum_options * pollStepInt)); } }, @@ -83,7 +83,7 @@ export default Ember.Controller.extend({ @computed("isNumber", "pollMax") pollStepOptions(isNumber, pollMax) { if (!isNumber) return; - return this._comboboxOptions(1, parseInt(pollMax) + 1); + return this._comboboxOptions(1, (parseInt(pollMax) || 1) + 1); }, @computed("isNumber", "showMinMax", "pollName", "pollType", "publicPoll", "pollOptions", "pollMin", "pollMax", "pollStep")