Permalink
Browse files

Merge pull request #212 from StyleShare/master

Fix a crash when key is null in mtl_valueMappingTransformer
  • Loading branch information...
jspahrsummers committed Jan 16, 2014
2 parents 43910cd + 3b860fd commit 0e7dde3d7ae6b41ceabd185ac415807edab074ce
Showing with 1 addition and 1 deletion.
  1. +1 −1 Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.m
@@ -121,7 +121,7 @@ + (NSValueTransformer *)mtl_valueMappingTransformerWithDictionary:(NSDictionary
NSParameterAssert(dictionary.count == [[NSSet setWithArray:dictionary.allValues] count]);
return [MTLValueTransformer reversibleTransformerWithForwardBlock:^(id<NSCopying> key) {
- return dictionary[key];
+ return dictionary[key ?: NSNull.null];
} reverseBlock:^(id object) {
__block id result = nil;
[dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id anObject, BOOL *stop) {

0 comments on commit 0e7dde3

Please sign in to comment.