[notmuch] [PATCH] notmuch-show: Do not output (null) when the message body is empty

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Mar 1 08:12:14 PST 2010


Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 notmuch-show.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 0f10797..4c794c4 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -310,10 +310,12 @@ format_part_json (GMimeObject *part, int *part_count)
     if (g_mime_content_type_is_type (content_type, "text", "*") &&
 	!g_mime_content_type_is_type (content_type, "text", "html"))
     {
-	show_part_content (part, stream_memory);
+        show_part_content (part, stream_memory);
 	part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM (stream_memory));
-
-	printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data));
+	if (part_content->data != NULL)
+	  printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data));
+	else
+	  printf (", \"content\": \"\"");
     }
 
     fputs ("}", stdout);
-- 
1.6.3.3



More information about the notmuch mailing list