From 067d4549379dc46b06669d6b9d434e9dfbeec3d6 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 5 Dec 2017 12:07:21 -0500 Subject: [PATCH] FIX: makes sur we have polls before validating --- plugins/poll/plugin.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index c3f2f901bd3..017ea72a81a 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -312,12 +312,14 @@ after_initialize do # only care when raw has changed! return unless self.raw_changed? || force - validator = DiscoursePoll::PostValidator.new(self) - return unless validator.validate_post - validator = DiscoursePoll::PollsValidator.new(self) return unless (polls = validator.validate_polls) + if !polls.empty? + validator = DiscoursePoll::PostValidator.new(self) + return unless validator.validate_post + end + # are we updating a post? if self.id.present? DistributedMutex.synchronize("#{PLUGIN_NAME}-#{self.id}") do