notmuch reply: Avoid segmentation fault when printing multiple parts
authorCarl Worth <cworth@cworth.org>
Tue, 24 May 2011 17:52:38 +0000 (10:52 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 24 May 2011 19:19:18 +0000 (12:19 -0700)
The code was previously trying to print a NULL string in this case, which
is obviously what we don't want to do.

show-message.c

index 32bb860f63dd8c86d54389d3d4333fde46956386..2ec9eca91d5095b8dd6409a98b743bc314c02a6b 100644 (file)
@@ -46,7 +46,7 @@ show_message_part (GMimeObject *part,
     selected = (params->part <= 0 || state->part_count == params->part);
 
     if (selected || state->in_zone) {
     selected = (params->part <= 0 || state->part_count == params->part);
 
     if (selected || state->in_zone) {
-       if (!first && (params->part <= 0 || state->in_zone))
+       if (!first && (params->part <= 0 || state->in_zone) && format->part_sep)
            fputs (format->part_sep, stdout);
 
        format->part (part, &(state->part_count));
            fputs (format->part_sep, stdout);
 
        format->part (part, &(state->part_count));