diff --git a/ChangeLog b/ChangeLog index efc2b563e..65f9e0007 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-08-17 Richard Frith-Macdonald + + * Source/NSObject.m: + * Source/NSDistantObject.m: + Return nil from (methodSignatureForSelector:) if the selector is null. + 2010-08-17 Wolfgang Lux * Source/NSNotificationQueue.m: remove_from_queue_no_release() diff --git a/Source/NSDistantObject.m b/Source/NSDistantObject.m index 5b2b827fb..7fb8516f5 100644 --- a/Source/NSDistantObject.m +++ b/Source/NSDistantObject.m @@ -669,6 +669,10 @@ enum proxyLocation */ - (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector { + if (0 == aSelector) + { + return nil; + } if (_object != nil) { return [_object methodSignatureForSelector: aSelector]; diff --git a/Source/NSObject.m b/Source/NSObject.m index b9eea0961..f79ec6d10 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -1461,7 +1461,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); /** * Returns the method signature describing how the receiver would handle * a message with aSelector. - *
Raises NSInvalidArgumentException if given a null selector. + *
Returns nil if given a null selector. */ - (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector { @@ -1469,9 +1469,10 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); struct objc_method *mth; Class c; - if (aSelector == 0) - [NSException raise: NSInvalidArgumentException - format: @"%@ null selector given", NSStringFromSelector(_cmd)]; + if (0 == aSelector) + { + return nil; + } c = (GSObjCIsInstance(self) ? object_getClass(self) : (Class)self); mth = GSGetMethod(c, aSelector, GSObjCIsInstance(self), YES); @@ -2395,6 +2396,10 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); { Class c; + if (0 == aSelector) + { + return nil; + } [allocationLock lock]; c = NSMapGet(zombieMap, (void*)self); [allocationLock unlock]; diff --git a/Source/NSProxy.m b/Source/NSProxy.m index 307071c37..a36341907 100644 --- a/Source/NSProxy.m +++ b/Source/NSProxy.m @@ -147,7 +147,7 @@ extern BOOL __objc_responds_to(id, SEL); { struct objc_method *mth; - if (aSelector == 0) + if (0 == aSelector) { return nil; } @@ -393,7 +393,7 @@ extern BOOL __objc_responds_to(id, SEL); { struct objc_method *mth; - if (aSelector == 0) + if (0 == aSelector) { return nil; }