aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/index.cc
diff options
context:
space:
mode:
authorGravatar martin f. krafft <madduck@madduck.net>2010-03-02 16:31:28 +0100
committerGravatar Carl Worth <cworth@cworth.org>2010-04-13 08:49:06 -0700
commit449a418c65fb1f9281f761aae23576900d0d3ef1 (patch)
tree4df019996e6e8555381a15c59ce5804a2a022b9e /lib/index.cc
parent423421526329f9c788e707301ee966eea911d261 (diff)
Do not segfault on empty mime parts
notmuch previously unconditionally checked mime parts for various properties, but not for NULL, which is the case if libgmime encounters an empty mime part. Upon encounter of an empty mime part, the following is printed to stderr (the second line due to my patch): (process:17197): gmime-CRITICAL **: g_mime_message_get_mime_part: assertion `GMIME_IS_MESSAGE (message)' failed Warning: Not indexing empty mime part. This is probably a bug that should get addressed in libgmime, but for not, my patch is an acceptable workaround. Signed-off-by: martin f. krafft <madduck@madduck.net>
Diffstat (limited to 'lib/index.cc')
-rw-r--r--lib/index.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/index.cc b/lib/index.cc
index cf930251..0d6640bc 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -336,6 +336,11 @@ _index_mime_part (notmuch_message_t *message,
GMimeContentDisposition *disposition;
char *body;
+ if (! part) {
+ fprintf (stderr, "Warning: Not indexing empty mime part.\n");
+ return;
+ }
+
if (GMIME_IS_MULTIPART (part)) {
GMimeMultipart *multipart = GMIME_MULTIPART (part);
int i;