better cope with null selectors.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31178 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-08-17 18:36:46 +00:00
parent 0b6e29fe21
commit 821a21b54d
4 changed files with 21 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2010-08-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSObject.m:
* Source/NSDistantObject.m:
Return nil from (methodSignatureForSelector:) if the selector is null.
2010-08-17 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSNotificationQueue.m: remove_from_queue_no_release()

View file

@ -669,6 +669,10 @@ enum proxyLocation
*/
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector
{
if (0 == aSelector)
{
return nil;
}
if (_object != nil)
{
return [_object methodSignatureForSelector: aSelector];

View file

@ -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.
* <br />Raises NSInvalidArgumentException if given a null selector.
* <br />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];

View file

@ -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;
}