From dd9e1a4611465e75480ea9dc252ebdaae1816375 Mon Sep 17 00:00:00 2001 From: theraven Date: Mon, 7 Jun 2010 00:28:52 +0000 Subject: [PATCH] Don't infinite loop when trying to send an unimplemented message to an object that doesn't implement -methodSignatureForSelector: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30593 72102866-910b-0410-8b05-ffd578937521 --- Source/GSFFIInvocation.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/GSFFIInvocation.m b/Source/GSFFIInvocation.m index 759cd1610..cc134dca6 100644 --- a/Source/GSFFIInvocation.m +++ b/Source/GSFFIInvocation.m @@ -147,7 +147,19 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel) NSMethodSignature *sig; GSCodeBuffer *memory; - sig = [receiver methodSignatureForSelector: sel]; + if (class_respondsToSelector(receiver->isa, sel)) + { + sig = [receiver methodSignatureForSelector: sel]; + } + else + { + [NSException raise: NSInvalidArgumentException + format: @"GSFFIInvocation: Class '%s'(%s) does not respond" + @" to forwardInvocation: for '%s'", + GSClassNameFromObject(receiver), + GSObjCIsInstance(receiver) ? "instance" : "class", + sel ? sel_getName(sel) : "(null)"]; + } if (sig == nil) {