Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/lib/heliotrope/message.rb b/lib/heliotrope/message.rb
index 5d6fe10..0ff640e 100644
--- a/lib/heliotrope/message.rb
+++ b/lib/heliotrope/message.rb
@@ -172,9 +172,10 @@ private
if part.multipart?
if mime_type_for(part) =~ /multipart\/alternative/
target = part.body.find { |p| mime_type_for(p).index(preferred_type) } || part.body.first
- decode_mime_parts target, preferred_type, level + 1
+ decode_mime_parts target, preferred_type, level + 1 unless target.nil?
else # decode 'em all
- part.body.map { |subpart| decode_mime_parts subpart, preferred_type, level + 1 }.flatten 1
+ part.body.map { |subpart|
+ decode_mime_parts subpart, preferred_type, level + 1 unless subpart.nil? }.flatten 1
end
else
type = mime_type_for part
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.