[balsa] Do not remove invalid array element
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Do not remove invalid array element
- Date: Fri, 15 Oct 2010 01:46:09 +0000 (UTC)
commit d489926ffe29e4d048a65b2ef60c576882fce4b1
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Oct 14 21:44:04 2010 -0400
Do not remove invalid array element
ChangeLog | 5 +++++
libbalsa/mailbox_imap.c | 12 ++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7c3acef..f871d57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-14 Peter Bloomfield
+
+ * libbalsa/mailbox_imap.c (imap_expunge_cb): do not remove
+ invalid array element.
+
2010-09-26 Peter Bloomfield
Use separate mutexes for mailbox locking and checking mail
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index 84fddf8..6cce6cc 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -909,7 +909,6 @@ imap_expunge_cb(ImapMboxHandle *handle, unsigned seqno,
{
ImapMessage *imsg;
guint i;
- gchar *msgid;
LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(mimap);
struct message_info *msg_info;
@@ -938,9 +937,14 @@ imap_expunge_cb(ImapMboxHandle *handle, unsigned seqno,
g_object_unref(msg_info->message);
g_array_remove_index(mimap->messages_info, seqno-1);
}
- msgid = g_ptr_array_index(mimap->msgids, seqno-1);
- if(msgid) g_free(msgid);
- g_ptr_array_remove_index(mimap->msgids, seqno-1);
+
+ if (seqno <= mimap->msgids->len) {
+ gchar *msgid;
+
+ msgid = g_ptr_array_index(mimap->msgids, seqno - 1);
+ g_free(msgid);
+ g_ptr_array_remove_index(mimap->msgids, seqno - 1);
+ }
for (i = seqno - 1; i < mimap->messages_info->len; i++) {
struct message_info *msg_info =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]