]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/slashdot.rb
plugins: raise a descriptive LoadError when the db is corrupt on load
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / slashdot.rb
index b02a5a25809c4733b19299175099df507ff638a2..71411458e7300565cd1b069d240b1e39ade44953 100644 (file)
@@ -21,8 +21,13 @@ class SlashdotPlugin < Plugin
     loc = Utils.check_location(s, /slashdot\.org/)
     return nil unless loc
     h = Hpricot(s[:text])
-    title = (h/"head/title").first.to_html.ircify_html
+    # If we have no title tag in a head tag, return as this is not
+    # a /. page (it's probably a Slashdot RSS
+    ht = h/"head/title"
+    return nil if ht.empty?
+    title = ht.first.to_html.ircify_html
     arts = (h/"div.article")
+    return nil if arts.empty?
     if arts.length > 1
       tits = []
       arts.each { |el|