Although it is not directly documented, CPMutableSet -addObject should raise with nil or undefined.

This commit is contained in:
Aparajita Fishman
2011-05-09 15:49:44 -04:00
parent 3d614b38c1
commit ea958160dc
2 changed files with 2 additions and 4 deletions
+1 -3
View File
@@ -424,9 +424,7 @@ var CPSetObjectsKey = @"CPSetObjectsKey";
{
var value = [object valueForKey:aKey];
// addObject: should be smart enough not to add these, but just in case...
if (value !== nil && value !== undefined)
[valueSet addObject:value];
[valueSet addObject:value];
}
return valueSet;
+1 -1
View File
@@ -85,7 +85,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
- (void)addObject:(id)anObject
{
if (anObject === nil || anObject === undefined)
return;
[CPException raise:CPInvalidArgumentException reason:@"attempt to insert nil or undefined"];
if ([self containsObject:anObject])
return;