[evolution] Fix a runtime warning for zero-length attachments.
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution] Fix a runtime warning for zero-length attachments.
- Date: Tue, 9 Jun 2009 06:33:48 -0400 (EDT)
commit 209168921d0e6cbc38c6856e45af7085696b961e
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Jun 3 15:02:14 2009 -0400
Fix a runtime warning for zero-length attachments.
---
widgets/misc/e-attachment.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 35c377a..ba2811d 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]