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 <[email protected]>
---
 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 -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to