@@ -22,10 +22,11 @@ #import "OFObject.h" #import "OFObject+KeyValueCoding.h" #import "OFString.h" #import "OFNumber.h" +#import "OFInvalidArgumentException.h" #import "OFOutOfMemoryException.h" #import "OFUndefinedKeyException.h" int _OFObject_KeyValueCoding_reference; @@ -137,10 +138,15 @@ if (*typeEncoding != 0) { [self setValue: value forUndefinedKey: key]; return; } + + if (valueType != '@' && valueType != '#' && value == nil) { + [self setNilValueForKey: key]; + return; + } switch (valueType) { case '@': case '#': { @@ -184,6 +190,11 @@ { @throw [OFUndefinedKeyException exceptionWithObject: self key: key value: value]; } + +- (void)setNilValueForKey: (OFString*)key +{ + @throw [OFInvalidArgumentException exception]; +} @end