Update hadling of nil args to match OS-X

This commit is contained in:
rfm 2024-07-17 11:32:01 +01:00
parent 1a1e7f7fc5
commit 2c1a993612
2 changed files with 8 additions and 8 deletions

View file

@ -837,11 +837,11 @@ const NSHashTableCallBacks NSPointerToStructHashCallBacks =
GSIMapTable t = (GSIMapTable)self;
GSIMapNode n;
if (anObject == nil)
if (nil == anObject)
{
[NSException raise: NSInvalidArgumentException
format: @"[%@-%@:] given nil argument",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
/* Tested behavior on os-x 14.5 is to do nothing if the arg is nil
*/
return;
}
n = GSIMapNodeForKey(t, (GSIMapKey)anObject);

View file

@ -1382,11 +1382,11 @@ const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks =
{
GSIMapNode node;
if (aKey == nil)
if (nil == aKey || nil == anObject)
{
[NSException raise: NSInvalidArgumentException
format: @"[%@-%@:] given nil argument",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
/* tested behavior on os-x 14.5 is to do nothing if either arg is nil
*/
return;
}
node = GSIMapNodeForKey(self, (GSIMapKey)aKey);
if (node)