From c02b5600fa512108d44b9163f44764a9552bbb73 Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Wed, 5 Jun 2019 14:57:12 -0400 Subject: [PATCH] fix mail.html_part undefined --- app/models/comment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index b25a5240da..60892a940a 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -261,8 +261,8 @@ def self.add_answer_comment(mail, answer_id, user) def self.add_comment(mail, node_id, user) node = Node.where(nid: node_id).first - if node - mail_doc = Nokogiri::HTML(mail.html_part.body.decoded) # To parse the mail to extract comment content and reply content + if node && mail&.html_part + mail_doc = Nokogiri::HTML(mail&.html_part&.body&.decoded) # To parse the mail to extract comment content and reply content domain = get_domain mail.from.first content = if domain == "gmail" gmail_parsed_mail mail_doc