]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-show.c
Avoid giving GMime a NULL MIME-stream filter.
[notmuch] / notmuch-show.c
index 26449fa5bd0c2efde1d6f45460ee36cef60ce342..4ed5fc74a1796f98ef41da996c7f4ee5e55df6a4 100644 (file)
@@ -225,9 +225,15 @@ show_part_content (GMimeObject *part, GMimeStream *stream_out)
        g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
                                 g_mime_filter_crlf_new(FALSE, FALSE));
         if (charset) {
-          g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
-                                   g_mime_filter_charset_new(charset, "UTF-8"));
-        }
+           GMimeFilter *charset_filter;
+           charset_filter = g_mime_filter_charset_new(charset, "UTF-8");
+           /* This result can be NULL for things like "unknown-8bit".
+            * Don't set a NULL filter as that makes GMime print
+            * annoying assertion-failure messages on stderr. */
+           if (charset_filter)
+               g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
+                                        charset_filter);
+       }
     }
 
     wrapper = g_mime_part_get_content_object (GMIME_PART (part));