Skip to content
Browse files

Don't include empty BCC field

  • Loading branch information...
1 parent b85d093 commit 1d4ee055d3756f472269afd2fb103a82bfb9abdb @mronge mronge committed Jan 28, 2014
Showing with 20 additions and 1 deletion.
  1. +20 −1 Source/CTCoreMessage.m
View
21 Source/CTCoreMessage.m
@@ -513,7 +513,10 @@ - (NSSet *)to {
- (void)setTo:(NSSet *)addresses {
struct mailimf_address_list *imf = [self _IMFAddressListFromAddresssList:addresses];
-
+ if (!imf) {
+ return;
+ }
+
if (myFields->fld_to != NULL) {
mailimf_address_list_free(myFields->fld_to->to_addr_list);
myFields->fld_to->to_addr_list = imf;
@@ -572,6 +575,10 @@ - (NSSet *)cc {
- (void)setCc:(NSSet *)addresses {
struct mailimf_address_list *imf = [self _IMFAddressListFromAddresssList:addresses];
+ if (!imf) {
+ return;
+ }
+
if (myFields->fld_cc != NULL) {
mailimf_address_list_free(myFields->fld_cc->cc_addr_list);
myFields->fld_cc->cc_addr_list = imf;
@@ -591,6 +598,10 @@ - (NSSet *)bcc {
- (void)setBcc:(NSSet *)addresses {
struct mailimf_address_list *imf = [self _IMFAddressListFromAddresssList:addresses];
+ if (!imf) {
+ return;
+ }
+
if (myFields->fld_bcc != NULL) {
mailimf_address_list_free(myFields->fld_bcc->bcc_addr_list);
myFields->fld_bcc->bcc_addr_list = imf;
@@ -610,6 +621,10 @@ - (NSSet *)replyTo {
- (void)setReplyTo:(NSSet *)addresses {
struct mailimf_address_list *imf = [self _IMFAddressListFromAddresssList:addresses];
+ if (!imf) {
+ return;
+ }
+
if (myFields->fld_reply_to != NULL) {
mailimf_address_list_free(myFields->fld_reply_to->rt_addr_list);
myFields->fld_reply_to->rt_addr_list = imf;
@@ -849,6 +864,10 @@ - (NSSet *)_addressListFromIMFAddressList:(struct mailimf_address_list *)imfList
- (struct mailimf_address_list *)_IMFAddressListFromAddresssList:(NSSet *)addresses {
+ if (!addresses) {
+ return NULL;
+ }
+
struct mailimf_address_list *imfList = mailimf_address_list_new_empty();
NSEnumerator *objEnum = [addresses objectEnumerator];

0 comments on commit 1d4ee05

Please sign in to comment.
Something went wrong with that request. Please try again.