From 3eb0ecb96b9136c38313256fbb88f03a4bb55614 Mon Sep 17 00:00:00 2001 From: theraven Date: Mon, 4 Apr 2011 13:43:21 +0000 Subject: [PATCH] Ensure that the superclass is registered when testing for protocol conformance. --- protocol.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/protocol.c b/protocol.c index b7dcefe..be2a85e 100644 --- a/protocol.c +++ b/protocol.c @@ -248,7 +248,7 @@ BOOL protocol_conformsToProtocol(Protocol *p1, Protocol *p2) BOOL class_conformsToProtocol(Class cls, Protocol *protocol) { if (Nil == cls || NULL == protocol) { return NO; } - while (cls) + for ( ; Nil != cls ; cls = class_getSuperclass(cls)) { for (struct objc_protocol_list *protocols = cls->protocols; protocols != NULL ; protocols = protocols->next) @@ -262,7 +262,6 @@ BOOL class_conformsToProtocol(Class cls, Protocol *protocol) } } } - cls = cls->super_class; } return NO; }