[PATCH] Do not attept to output part raw if part is not GMimePart.

Subject: [PATCH] Do not attept to output part raw if part is not GMimePart.

Date: Thu, 2 Jun 2011 09:38:55 -0700

To: Notmuch Mail

Cc:

From: Jameson Graef Rollins


This was a minor oversite in checking of part type when outputing
content raw.  This was causing gmime was to throw an exception to
stderr.

Unfortunately the gmime exception was not being caught by notmuch, or
the test suite.  I'm not sure if notmuch should have done anything in
this case, but certainly the test suite should be capable of detecting
that something unexpected was output to stderr.
---
 notmuch-show.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 9267d02..3b4f775 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -646,14 +646,15 @@ format_part_content_raw (GMimeObject *part)
 {
     GMimeStream *stream_stdout;
     GMimeStream *stream_filter = NULL;
-    GMimeDataWrapper *wrapper;
+    GMimeDataWrapper *wrapper = NULL;
 
     stream_stdout = g_mime_stream_file_new (stdout);
     g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
 
     stream_filter = g_mime_stream_filter_new (stream_stdout);
 
-    wrapper = g_mime_part_get_content_object (GMIME_PART (part));
+    if (GMIME_IS_PART (part))
+	wrapper = g_mime_part_get_content_object (GMIME_PART (part));
 
     if (wrapper && stream_filter)
 	g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
-- 
1.7.4.4


Thread: