Skip to content

Instantly share code, notes, and snippets.

@zonble
Last active August 29, 2015 14:13
Show Gist options
  • Save zonble/f33ee2c191b9fe0da406 to your computer and use it in GitHub Desktop.
Save zonble/f33ee2c191b9fe0da406 to your computer and use it in GitHub Desktop.
@implementation NSNull (SafeNull)
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
NSMethodSignature *signature = [super methodSignatureForSelector:aSelector];
if (!signature) {
NSLog(@"Warning: Unsuported selector \"%@\" sent to NSNull object.", NSStringFromSelector(aSelector));
return [NSMethodSignature signatureWithObjCTypes:@encode(void)];
}
return signature;
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment