Skip to content

Commit

Permalink
don't crash when messaging methodSignatureForSelector: to NSProxy cla…
Browse files Browse the repository at this point in the history
…ss or instance
  • Loading branch information
Laurent Sansonetti committed May 27, 2011
1 parent f03ba94 commit 3998ca5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion objc.m
Expand Up @@ -103,7 +103,14 @@
rb_objc_supports_forwarding(VALUE recv, SEL sel)
{
if (!SPECIAL_CONST_P(recv)) {
return [(id)recv methodSignatureForSelector:sel] != nil;
@try {
// Protect the call since it may throw an exception when called on
// NSProxy class or instance.
return [(id)recv methodSignatureForSelector:sel] != nil;
}
@catch (id exc) {
return false;
}
}
return false;
}
Expand Down

0 comments on commit 3998ca5

Please sign in to comment.