From 023b4a5a7302a90885b128ce7ddd4bd64b6ef3f4 Mon Sep 17 00:00:00 2001 From: Evan Schoenberg Date: Mon, 7 Jan 2008 03:09:29 +0000 Subject: [PATCH] Resolve aliases passed to BGICLogImportController, and catch exceptions thrown by the NSKeyedUnarchiver/NSUnarchiver when attempting to parse an iChat log and log them rather than crashing. Fixes #8729 git-svn-id: svn://svn.adiumx.com/adium/trunk@22159 1c916fce-81e2-0310-a464-8ca513f45935 --- Source/BGICLogImportController.m | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Source/BGICLogImportController.m b/Source/BGICLogImportController.m index 9d9c27df8..366f0bdda 100644 --- a/Source/BGICLogImportController.m +++ b/Source/BGICLogImportController.m @@ -21,6 +21,7 @@ #import #import #import +#import // InstantMessage and other iChat transcript classes are from Spiny Software's Logorrhea, used with permission. #import "InstantMessage.h" @@ -64,10 +65,24 @@ [xhtmlDecoder setUsesAttachmentTextEquivalents:YES]; // read the raw file into an array for working against, two different formats have been employed by iChat, based on available classes - NSArray *rawChat = ([[fullPath pathExtension] isEqual:@"ichat"] ? - [NSKeyedUnarchiver unarchiveObjectWithFile:fullPath] : - [NSUnarchiver unarchiveObjectWithFile:fullPath]); + fullPath = [[NSFileManager defaultManager] pathByResolvingAlias:fullPath]; + + NSArray *rawChat; + @try + { + rawChat = ([[fullPath pathExtension] isEqual:@"ichat"] ? + [NSKeyedUnarchiver unarchiveObjectWithFile:fullPath] : + [NSUnarchiver unarchiveObjectWithFile:fullPath]); + } + @catch (NSException *releaseException) + { + NSLog(@"Could not open iChat log at %@: %@", fullPath, releaseException); + rawChat = nil; + } + + if (!rawChat) return NO; + NSString *preceedingPath = nil; #ifndef LOG_TO_TEST -- 2.11.4.GIT