lib/html2doc/mime.rb in html2doc-1.0.1 vs lib/html2doc/mime.rb in html2doc-1.0.2

- old
+ new

@@ -66,9 +66,10 @@ # max width for Word document is 400, max height is 680 def self.image_resize(i, path, maxheight, maxwidth) realSize = ImageSize.path(path).size s = [i["width"].to_i, i["height"].to_i] s = realSize if s[0].zero? && s[1].zero? + return [nil, nil] if realSize[0].nil? || realSize[1].nil? s[1] = s[0] * realSize[1] / realSize[0] if s[1].zero? && !s[0].zero? s[0] = s[1] * realSize[0] / realSize[1] if s[0].zero? && !s[1].zero? s = [(s[0] * maxheight / s[1]).ceil, maxheight] if s[1] > maxheight s = [maxwidth, (s[1] * maxwidth / s[0]).ceil] if s[0] > maxwidth s