Skip to content
Browse files

Protects the dereferences of the struct mailmessage *myMessage.

  • Loading branch information...
1 parent 1ce3163 commit d9a69fe3c7fe7592568248d247096a34451712c6 @ghdk ghdk committed Dec 1, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 Source/CTCoreMessage.m
View
10 Source/CTCoreMessage.m
@@ -382,7 +382,7 @@ - (NSDate *)senderDate {
}
- (BOOL)isUnread {
- struct mail_flags *flags = myMessage->msg_flags;
+ struct mail_flags *flags = myMessage ? myMessage->msg_flags : NULL;
if (flags != NULL) {
BOOL flag_seen = (flags->fl_flags & MAIL_FLAG_SEEN);
return !flag_seen;
@@ -391,7 +391,7 @@ - (BOOL)isUnread {
}
- (BOOL)isStarred {
- struct mail_flags *flags = myMessage->msg_flags;
+ struct mail_flags *flags = myMessage ? myMessage->msg_flags : NULL;
if (flags != NULL) {
BOOL flag_starred = (flags->fl_flags & MAIL_FLAG_FLAGGED);
return flag_starred;
@@ -400,7 +400,7 @@ - (BOOL)isStarred {
}
- (BOOL)isNew {
- struct mail_flags *flags = myMessage->msg_flags;
+ struct mail_flags *flags = myMessage ? myMessage->msg_flags : NULL;
if (flags != NULL) {
BOOL flag_seen = (flags->fl_flags & MAIL_FLAG_SEEN);
BOOL flag_new = (flags->fl_flags & MAIL_FLAG_NEW);
@@ -418,7 +418,7 @@ - (NSString *)messageId {
}
- (NSUInteger)uid {
- if (myMessage->msg_uid) {
+ if (myMessage && myMessage->msg_uid) {
NSString *uidString = [[NSString alloc] initWithCString:myMessage->msg_uid encoding:NSASCIIStringEncoding];
NSUInteger uid = (NSUInteger)[[[uidString componentsSeparatedByString:@"-"] objectAtIndex:1] intValue];
[uidString release];
@@ -619,7 +619,7 @@ - (NSData *)messageAsEmlx {
[emlx appendData:msgContentAsData];
- struct mail_flags *flagsStruct = myMessage->msg_flags;
+ struct mail_flags *flagsStruct = myMessage ? myMessage->msg_flags : NULL;
uint64_t flags = 0;
if (flagsStruct != NULL) {
BOOL seen = (flagsStruct->fl_flags & CTFlagSeen) > 0;

0 comments on commit d9a69fe

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