Revision: 9763 http://sourceforge.net/p/skim-app/code/9763 Author: hofman Date: 2018-04-12 17:50:01 +0000 (Thu, 12 Apr 2018) Log Message: ----------- return invalid data error when bunzip failed
Modified Paths: -------------- trunk/SkimNotes/SKNExtendedAttributeManager.m Modified: trunk/SkimNotes/SKNExtendedAttributeManager.m =================================================================== --- trunk/SkimNotes/SKNExtendedAttributeManager.m 2018-04-12 17:43:34 UTC (rev 9762) +++ trunk/SkimNotes/SKNExtendedAttributeManager.m 2018-04-12 17:50:01 UTC (rev 9763) @@ -279,7 +279,11 @@ [attribute release]; attribute = success ? [[self bunzipData:buffer] retain] : nil; - if (success == NO && NULL != error) *error = [NSError errorWithDomain:SKNSkimNotesErrorDomain code:SKNReassembleAttributeFailedError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, SKNLocalizedString(@"Failed to reassemble attribute value.", @"Error description"), NSLocalizedDescriptionKey, nil]]; + if (success == NO && NULL != error) + *error = [NSError errorWithDomain:SKNSkimNotesErrorDomain code:SKNReassembleAttributeFailedError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, SKNLocalizedString(@"Failed to reassemble attribute value.", @"Error description"), NSLocalizedDescriptionKey, nil]]; + else if (attribute == nil && NULL != error) + *error = [NSError errorWithDomain:SKNSkimNotesErrorDomain code:SKNInvalidDataError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SKNLocalizedString(@"Invalid data.", @"Error description"), NSLocalizedDescriptionKey, nil]]; + } } return [attribute autorelease]; @@ -297,14 +301,19 @@ if ([self isBzipData:data]) data = [self bunzipData:data]; - NSString *errorString; - plist = [NSPropertyListSerialization propertyListFromData:data - mutabilityOption:NSPropertyListImmutable - format:NULL - errorDescription:&errorString]; - if (nil == plist) { - if (error) *error = [NSError errorWithDomain:SKNSkimNotesErrorDomain code:SKNPlistDeserializationFailedError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, errorString, NSLocalizedDescriptionKey, nil]]; - [errorString release]; + if (nil == data) { + if (error) *error = [NSError errorWithDomain:SKNSkimNotesErrorDomain code:SKNInvalidDataError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SKNLocalizedString(@"Invalid data.", @"Error description"), NSLocalizedDescriptionKey, nil]]; + + } else { + NSString *errorString; + plist = [NSPropertyListSerialization propertyListFromData:data + mutabilityOption:NSPropertyListImmutable + format:NULL + errorDescription:&errorString]; + if (nil == plist) { + if (error) *error = [NSError errorWithDomain:SKNSkimNotesErrorDomain code:SKNPlistDeserializationFailedError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, errorString, NSLocalizedDescriptionKey, nil]]; + [errorString release]; + } } } return plist; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit