summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/oxford.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/data/rbot/plugins/oxford.rb b/data/rbot/plugins/oxford.rb
index 5c9b0e4e..eba1b938 100644
--- a/data/rbot/plugins/oxford.rb
+++ b/data/rbot/plugins/oxford.rb
@@ -51,8 +51,10 @@ class OxfordPlugin < Plugin
url = "#{@base_url}/search/dataset.js?dataset=noad&dictionary=en&query=#{CGI.escape word}"
response = @bot.httputil.get(url, headers: {'X-Requested-With': 'XMLHttpRequest'})
alternative = response.gsub(/\\/, '').scan(/href="([^"]+)">([^<]+)</)
- url = @base_url + alternative.first[0]
- title = alternative.first[1]
+ unless alternative.empty?
+ url = @base_url + alternative.first[0]
+ title = alternative.first[1]
+ end
end
debug "search for alternative spelling result, returned title=#{title.inspect} url=#{url.inspect}"