]> rtime.felk.cvut.cz Git - notmuch.git/blobdiff - notmuch-show.c
Avoid giving GMime a NULL MIME-stream filter.
[notmuch.git] / notmuch-show.c
index 76873a1d9036337868811659c99bb105ad371dfe..4ed5fc74a1796f98ef41da996c7f4ee5e55df6a4 100644 (file)
@@ -145,7 +145,7 @@ format_message_json (const void *ctx, notmuch_message_t *message, unused (int in
     date = notmuch_message_get_date (message);
     relative_date = notmuch_time_relative_date (ctx, date);
 
-    printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"date_unix\": %ld, \"date_relative\": \"%s\", \"tags\": [",
+    printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",
            json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),
            notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",
            json_quote_str (ctx_quote, notmuch_message_get_filename (message)),
@@ -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));