[PATCH 04/13] vim: fix for missing parts

Subject: [PATCH 04/13] vim: fix for missing parts

Date: Sun, 18 Apr 2021 17:48:42 -0500

To: notmuch@notmuchmail.org

Cc: Felipe Contreras

From: Felipe Contreras


Sometimes Mail incorrectly parses multipart messages.

See: https://github.com/mikel/mail/issues/1438

Check for empty parts instead of crashing.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/notmuch.vim | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 541698cd..e2362a2d 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -332,9 +332,13 @@ ruby << EOF
 			b << "Cc: %s" % msg['cc']
 			b << "Date: %s" % msg['date']
 			nm_m.body_start = b.count
-			b << "--- %s ---" % part.mime_type
-			part.convert.each_line do |l|
-				b << l.chomp
+			if part
+				b << "--- %s ---" % part.mime_type
+				part.convert.each_line do |l|
+					b << l.chomp
+				end
+			else
+				b << "--- %s ---" % 'missing'
 			end
 			b << ""
 			nm_m.end = b.count
-- 
2.31.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: