mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Although it is not directly documented, CPMutableSet -addObject should raise with nil or undefined.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user