From 76a33be1100b2711f9ab41aedfabc7c4279d60a0 Mon Sep 17 00:00:00 2001 From: Vivek Jain Date: Thu, 28 Jul 2005 09:41:23 +0000 Subject: check for NULL before using the address. **Fixes bugs like #274544 2005-07-28 Vivek Jain * bbdb.c:(bbdb_handle_reply):check for NULL before using the address. **Fixes bugs like #274544 svn path=/trunk/; revision=29913 --- plugins/bbdb/ChangeLog | 6 ++++++ plugins/bbdb/bbdb.c | 36 +++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/plugins/bbdb/ChangeLog b/plugins/bbdb/ChangeLog index a22f7faae0..5def505a3e 100644 --- a/plugins/bbdb/ChangeLog +++ b/plugins/bbdb/ChangeLog @@ -1,3 +1,9 @@ +2005-07-28 Vivek Jain + + * bbdb.c:(bbdb_handle_reply):check for NULL + before using the address. + **Fixes bugs like #274544 + 2005-05-11 Not Zed * Makefile.am: setup cleanfiles/built_sources diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index c8dcaf7edb..7ac34375f6 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -115,11 +115,13 @@ bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target) return; cia = camel_mime_message_get_from (target->message); - for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { - const char *name=NULL, *email=NULL; - if (!(camel_internet_address_get (cia, i, &name, &email))) - continue; - bbdb_do_it (book, name, email); + if (cia) { + for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { + const char *name=NULL, *email=NULL; + if (!(camel_internet_address_get (cia, i, &name, &email))) + continue; + bbdb_do_it (book, name, email); + } } /* If this is a reply-all event, process To: and Cc: also. */ @@ -129,19 +131,23 @@ bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target) } cia = camel_mime_message_get_recipients (target->message, CAMEL_RECIPIENT_TYPE_TO); - for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { - const char *name=NULL, *email=NULL; - if (!(camel_internet_address_get (cia, i, &name, &email))) - continue; - bbdb_do_it (book, name, email); + if (cia) { + for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { + const char *name=NULL, *email=NULL; + if (!(camel_internet_address_get (cia, i, &name, &email))) + continue; + bbdb_do_it (book, name, email); + } } cia = camel_mime_message_get_recipients (target->message, CAMEL_RECIPIENT_TYPE_CC); - for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { - const char *name=NULL, *email=NULL; - if (!(camel_internet_address_get (cia, i, &name, &email))) - continue; - bbdb_do_it (book, name, email); + if (cia) { + for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { + const char *name=NULL, *email=NULL; + if (!(camel_internet_address_get (cia, i, &name, &email))) + continue; + bbdb_do_it (book, name, email); + } } g_object_unref (G_OBJECT (book)); -- cgit v1.2.3