diff --git a/Source/OCMock/OCPartialMockObject.m b/Source/OCMock/OCPartialMockObject.m index 6a7c53c3..b3019e03 100644 --- a/Source/OCMock/OCPartialMockObject.m +++ b/Source/OCMock/OCPartialMockObject.m @@ -206,6 +206,9 @@ - (void)setupForwarderForSelector:(SEL)sel Method originalMethod = class_getInstanceMethod(mockedClass, sel); /* Might be NULL if the selector is forwarded to another class */ IMP originalIMP = (originalMethod != NULL) ? method_getImplementation(originalMethod) : NULL; + if(originalIMP == NULL) + return; + const char *types = (originalMethod != NULL) ? method_getTypeEncoding(originalMethod) : NULL; // TODO: check the fallback implementation is actually sufficient if(types == NULL)