Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
Merge pull request #96 from flovilmart/fix-non-NSData-key
Browse files Browse the repository at this point in the history
Adds sanity check on NSData when unpacking value from defaults
  • Loading branch information
grp committed Oct 28, 2015
2 parents fc97caf + 13c78cd commit 67d3a76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion FBTweak/FBTweak.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ - (instancetype)initWithIdentifier:(NSString *)identifier
if ((self = [super init])) {
_identifier = identifier;
NSData *archivedValue = [[NSUserDefaults standardUserDefaults] objectForKey:_identifier];
_currentValue = (archivedValue == nil ? archivedValue : [NSKeyedUnarchiver unarchiveObjectWithData:archivedValue]);
_currentValue = (archivedValue != nil && [archivedValue isKindOfClass:[NSData class]] ? [NSKeyedUnarchiver unarchiveObjectWithData:archivedValue] : archivedValue);
}

return self;
Expand Down

0 comments on commit 67d3a76

Please sign in to comment.