While parsing check for existance of attribute

When parsing rel attributes, check for existance of the href attribute
before extracting the text, sometimes like in this post somewhere
https://www.patreon.com/posts/jeenas-excellent-6467133 it might be empty
and causes an exception. All the other uses above this one check that too.
This commit is contained in:
Jeena 2016-08-03 21:34:49 +02:00
parent 945ffe6c6e
commit f78162fd41

View file

@ -103,6 +103,7 @@ module Microformats2
else
rel_values.each do |rel_value|
@rels[rel_value] = [] unless @rels.has_key?(rel_value)
unless rel.attribute("href").nil?
@rels[rel_value] << Microformats2::AbsoluteUri.new(@base, rel.attribute("href").text).absolutize
end
end
@ -110,3 +111,4 @@ module Microformats2
end
end
end
end