diff options
author | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2014-05-01 11:30:29 -0700 |
---|---|---|
committer | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2014-05-01 11:30:29 -0700 |
commit | 587aa463682393d40e3666f32d5823363ad47a34 (patch) | |
tree | 1a21cb6b5213cdf1cb67ea2cfa69241a216d1bb4 /src/core/abstract | |
parent | e41ca9432453ca0848296ff18588016dbe294b48 (diff) |
Fixed crash when no sender is set (fixed #699)
Diffstat (limited to 'src/core/abstract')
-rw-r--r-- | src/core/abstract/MCMessageHeader.cc | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/core/abstract/MCMessageHeader.cc b/src/core/abstract/MCMessageHeader.cc index 668e1f5e..789da25e 100644 --- a/src/core/abstract/MCMessageHeader.cc +++ b/src/core/abstract/MCMessageHeader.cc @@ -1127,6 +1127,7 @@ Array * MessageHeader::recipientWithReplyAll(bool replyAll, bool includeTo, bool Set * addedAddresses; Array * toField; Array * ccField; + bool containsSender; toField = NULL; ccField = NULL; @@ -1135,9 +1136,21 @@ Array * MessageHeader::recipientWithReplyAll(bool replyAll, bool includeTo, bool hasCc = false; addedAddresses = new Set(); - if (senderEmails != NULL && - (senderEmails->containsObject(from()->mailbox()->lowercaseString()) || - senderEmails->containsObject(sender()->mailbox()->lowercaseString()))) { + containsSender = false; + if (senderEmails != NULL) { + if (from() != NULL) { + if (senderEmails->containsObject(from()->mailbox()->lowercaseString())) { + containsSender = true; + } + } + if (sender() != NULL) { + if (senderEmails->containsObject(sender()->mailbox()->lowercaseString())) { + containsSender = true; + } + } + } + + if (containsSender) { Array * recipient; recipient = new Array(); @@ -1147,16 +1160,14 @@ Array * MessageHeader::recipientWithReplyAll(bool replyAll, bool includeTo, bool if (addedAddresses->containsObject(address->mailbox()->lowercaseString())) { continue; } - if (address->mailbox()->isEqualCaseInsensitive(from()->mailbox())) { + if ((from() != NULL) && address->mailbox()->isEqualCaseInsensitive(from()->mailbox())) { recipient->addObjectsFromArray(replyTo()); - for(unsigned int j = 0 ; j < to()->count() ; j ++) { - Address * address = (Address *) replyTo()->objectAtIndex(j); - if (addedAddresses->containsObject(address->mailbox()->lowercaseString())) { + for(unsigned int j = 0 ; j < replyTo()->count() ; j ++) { + Address * rtAddress = (Address *) replyTo()->objectAtIndex(j); + if (addedAddresses->containsObject(rtAddress->mailbox()->lowercaseString())) { continue; } - if (address->mailbox() == NULL) - continue; - addedAddresses->addObject(address->mailbox()->lowercaseString()); + addedAddresses->addObject(rtAddress->mailbox()->lowercaseString()); } } else { |