[balsa] check for error in GMimeParser
- From: Peter Bloomfield <PeterB src gnome org>
- To: svn-commits-list gnome org
- Subject: [balsa] check for error in GMimeParser
- Date: Thu, 9 Jul 2009 23:41:21 +0000 (UTC)
commit 6ab979696fdc2f79cc63d747c76a9a636216215d
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Jul 9 19:39:25 2009 -0400
check for error in GMimeParser
ChangeLog | 5 +++++
libbalsa/mailbox_mbox.c | 13 +++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 218c6f4..8d2e032 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-09 Peter Bloomfield
+
+ * libbalsa/mailbox_mbox.c (libbalsa_mailbox_mbox_sync): check
+ for error in GMimeParser.
+
2009-06-30 Peter Bloomfield
* configure.in: test for res_init.
diff --git a/libbalsa/mailbox_mbox.c b/libbalsa/mailbox_mbox.c
index a50fc80..3039d1e 100644
--- a/libbalsa/mailbox_mbox.c
+++ b/libbalsa/mailbox_mbox.c
@@ -1700,10 +1700,12 @@ libbalsa_mailbox_mbox_sync(LibBalsaMailbox * mailbox, gboolean expunge)
}
if (msg_info->local_info.message)
msg_info->local_info.message->msgno = j + 1;
- j++;
msg_info->status = msg_info->x_status = msg_info->mime_version = -1;
mime_msg = g_mime_parser_construct_message(gmime_parser);
+ if (!mime_msg)
+ /* Try to recover */
+ continue;
msg_info->start = g_mime_parser_get_from_offset(gmime_parser);
/* Make sure we don't have offsets for any encapsulated headers. */
@@ -1715,11 +1717,16 @@ libbalsa_mailbox_mbox_sync(LibBalsaMailbox * mailbox, gboolean expunge)
msg_info->mime_version = -1;
from = g_mime_parser_get_from(gmime_parser);
+ if (!from) {
+ /* Try to recover */
+ g_object_unref(mime_msg);
+ continue;
+ }
+
msg_info->from_len = strlen(from) + 1;
g_free(from);
msg_info->end = g_mime_parser_tell(gmime_parser);
msg_info->orig_flags = REAL_FLAGS(msg_info->local_info.flags);
- g_assert(mime_msg != NULL);
g_assert(mime_msg->mime_part != NULL);
if (!msg_info->local_info.message || !msg_info->local_info.message->mime_msg)
g_object_unref(mime_msg);
@@ -1732,6 +1739,8 @@ libbalsa_mailbox_mbox_sync(LibBalsaMailbox * mailbox, gboolean expunge)
libbalsa_message_body_set_mime_body(msg_info->local_info.message->body_list,
mime_msg->mime_part);
}
+
+ j++;
}
libbalsa_mime_stream_shared_unlock(mbox_stream);
mbox->msgno_2_msg_info->len = j;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]