From 9594aede7d8888e3b03e9626e3c7b807ae1d1bed Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Wed, 28 Dec 2016 09:11:55 +0100 Subject: [PATCH] MacGui: do not call decodeObjectOfClasses:forKey: on 10.7, fix loading queue from disk that had been broken since enabling NSSecureCoding. --- macosx/HBDistributedArray.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/macosx/HBDistributedArray.m b/macosx/HBDistributedArray.m index 432e5cd29..8a9baef1d 100644 --- a/macosx/HBDistributedArray.m +++ b/macosx/HBDistributedArray.m @@ -199,14 +199,18 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk"; NSMutableArray *jobsArray = nil; @try { - NSData *queue = [NSData dataWithContentsOfURL:self.fileURL]; - NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:queue]; - if ([unarchiver respondsToSelector:@selector(requiresSecureCoding)]) + if ([NSKeyedUnarchiver instancesRespondToSelector:@selector(requiresSecureCoding)]) { + NSData *queue = [NSData dataWithContentsOfURL:self.fileURL]; + NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:queue]; unarchiver.requiresSecureCoding = YES; + jobsArray = [unarchiver decodeObjectOfClasses:self.objectClasses forKey:NSKeyedArchiveRootObjectKey]; + [unarchiver finishDecoding]; + } + else + { + jobsArray = [NSKeyedUnarchiver unarchiveObjectWithFile:self.fileURL.path]; } - jobsArray = [unarchiver decodeObjectOfClasses:self.objectClasses forKey:NSKeyedArchiveRootObjectKey]; - [unarchiver finishDecoding]; } @catch (NSException *exception) { -- 2.40.0