diff --git a/ChangeLog b/ChangeLog index cd8723c63..448a73e93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-09-27 Wolfgang Sourdeau + * OpenChange/MAPIStoreFolder.m + (-moveCopyMessagesWithMID:fromFolder:withMID:wantCopy:): ensure + the message URL exists in the MAPIStoreMapping, otherwise fail + with MAPISTORE_ERR_NOT_FOUND, to avoid a crash. + * OpenChange/MAPIStoreFSMessage.m (-objectVersion): return 0xff...fff when "version" does not exist in the object properties. diff --git a/OpenChange/MAPIStoreFolder.m b/OpenChange/MAPIStoreFolder.m index 3e60e4ee4..e758d3eb6 100644 --- a/OpenChange/MAPIStoreFolder.m +++ b/OpenChange/MAPIStoreFolder.m @@ -641,6 +641,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe int rc = MAPISTORE_SUCCESS; NSUInteger count; NSMutableArray *oldMessageURLs; + NSString *oldMessageURL; MAPIStoreMapping *mapping; if ([sourceFolder isKindOfClass: isa] @@ -651,11 +652,17 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe mapping = [[self context] mapping]; for (count = 0; rc == MAPISTORE_SUCCESS && count < midCount; count++) { - [oldMessageURLs addObject: [mapping urlFromID: srcMids[count]]]; - rc = [self moveCopyMessageWithMID: srcMids[count] - fromFolder: sourceFolder - withMID: targetMids[count] - wantCopy: wantCopy]; + oldMessageURL = [mapping urlFromID: srcMids[count]]; + if (oldMessageURL) + { + [oldMessageURLs addObject: oldMessageURL]; + rc = [self moveCopyMessageWithMID: srcMids[count] + fromFolder: sourceFolder + withMID: targetMids[count] + wantCopy: wantCopy]; + } + else + rc = MAPISTORE_ERR_NOT_FOUND; } /* Notifications */