From 1164129edcf82296bb6492b35ea99e3361a5fa2c Mon Sep 17 00:00:00 2001
From: Gerhard Schlager <mail@gerhard-schlager.at>
Date: Wed, 13 Jan 2016 22:57:57 +0100
Subject: [PATCH] Better error handling for polls imported from phpBB3

---
 script/import_scripts/phpbb3/importers/poll_importer.rb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/script/import_scripts/phpbb3/importers/poll_importer.rb b/script/import_scripts/phpbb3/importers/poll_importer.rb
index b3099f20c1b..e6bae5b40b7 100644
--- a/script/import_scripts/phpbb3/importers/poll_importer.rb
+++ b/script/import_scripts/phpbb3/importers/poll_importer.rb
@@ -22,6 +22,8 @@ module ImportScripts::PhpBB3
       poll_text = get_poll_text(options, poll)
       extracted_poll = extract_default_poll(topic_id, poll_text)
 
+      return if extracted_poll.nil?
+
       update_poll(extracted_poll, options, topic_id, poll)
 
       mapped_poll = {
@@ -83,6 +85,9 @@ module ImportScripts::PhpBB3
       extracted_polls.each do |poll|
         return poll if poll['name'] == @default_poll_name
       end
+
+      puts "Failed to extract poll for topic id #{topic_id}. The poll text is:"
+      puts poll_text
     end
 
     # @param poll [ImportScripts::PhpBB3::Poll]