aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-06-04 03:02:14 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-06-04 22:57:29 +0800
commit05ffc39af8369116e830fd6a70c4fe54857a6336 (patch)
tree10b526c01e677497d947110b4cb3039ebbc172d6 /widgets/misc
parentf0da93ccd071b8c56e91d52035b460a60828044c (diff)
downloadgsoc2013-evolution-05ffc39af8369116e830fd6a70c4fe54857a6336.tar.gz
gsoc2013-evolution-05ffc39af8369116e830fd6a70c4fe54857a6336.tar.zst
gsoc2013-evolution-05ffc39af8369116e830fd6a70c4fe54857a6336.zip
Fix a runtime warning for zero-length attachments.
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-attachment.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 35c377abe5..ba2811d5d9 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -2430,10 +2430,14 @@ attachment_save_got_output_stream (SaveContext *save_context)
camel_data_wrapper_decode_to_stream (wrapper, stream);
camel_object_unref (stream);
- /* Load the buffer into a GMemoryInputStream. */
- input_stream = g_memory_input_stream_new_from_data (
- buffer->data, (gssize) buffer->len,
- (GDestroyNotify) g_free);
+ /* Load the buffer into a GMemoryInputStream.
+ * But watch out for zero length MIME parts. */
+ input_stream = g_memory_input_stream_new ();
+ if (buffer->len > 0)
+ g_memory_input_stream_add_data (
+ G_MEMORY_INPUT_STREAM (input_stream),
+ buffer->data, (gssize) buffer->len,
+ (GDestroyNotify) g_free);
save_context->input_stream = input_stream;
save_context->total_num_bytes = (goffset) buffer->len;
g_byte_array_free (buffer, FALSE);