Skip to content

Commit

Permalink
Merge pull request cantino#31 from bestvendor/master
Browse files Browse the repository at this point in the history
Don't crash when images don't have a src attribute
  • Loading branch information
cantino committed May 28, 2012
2 parents 6a14edd + 8c26e94 commit 2f0f375
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/readability.rb
Expand Up @@ -71,6 +71,8 @@ def images(content=nil, reload=false)
elements = content.css("img").map(&:attributes)

elements.each do |element|
next unless element["src"]

url = element["src"].value
height = element["height"].nil? ? 0 : element["height"].value.to_i
width = element["width"].nil? ? 0 : element["width"].value.to_i
Expand Down

0 comments on commit 2f0f375

Please sign in to comment.