From f2fca545eaa8ce98ed2d7dc6b6a7e81853c624f0 Mon Sep 17 00:00:00 2001 From: Khaled Annajar Date: Wed, 17 Feb 2016 18:20:53 +0200 Subject: [PATCH] fix crash caused by setting nil to a primitive attribute. --- KeyValueObjectMapping/DCAttributeSetter.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KeyValueObjectMapping/DCAttributeSetter.m b/KeyValueObjectMapping/DCAttributeSetter.m index faedfa7..6f0f990 100644 --- a/KeyValueObjectMapping/DCAttributeSetter.m +++ b/KeyValueObjectMapping/DCAttributeSetter.m @@ -21,6 +21,8 @@ + (void)assingValue:(id)value forAttributeName: (NSString *)attributeName andAtt if(([value isKindOfClass:[NSNull class]] || value == nil) && attributeClass == [NSString class]){ [object setValue:nil forKey:attributeName]; + }else if(([value isKindOfClass:[NSNull class]] || value == nil) && attributeClass == nil) { + [object setValue:@0 forKey:attributeName]; }else { @try { [object setValue:value forKey:attributeName];