Skip to content

Commit

Permalink
negate logic to actually do what the function implies.
Browse files Browse the repository at this point in the history
  • Loading branch information
steipete committed May 5, 2014
1 parent 1a9e61c commit c12e11a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Aspects.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ static SEL aspect_aliasForSelector(SEL selector) {
#pragma mark - Class + Selector Preparation

static BOOL aspect_isMsgForwardIMP(IMP impl) {
return impl != _objc_msgForward
return impl == _objc_msgForward
#if !defined(__arm64__)
&& impl != (IMP)_objc_msgForward_stret
|| impl == (IMP)_objc_msgForward_stret
#endif
;
}
Expand All @@ -162,7 +162,7 @@ static void aspect_prepareClassAndHookSelector(NSObject *self, SEL selector, NSE
Class klass = aspect_hookClass(self, error);
Method targetMethod = class_getInstanceMethod(klass, selector);
IMP targetMethodIMP = method_getImplementation(targetMethod);
if (aspect_isMsgForwardIMP(targetMethodIMP)) {
if (!aspect_isMsgForwardIMP(targetMethodIMP)) {
// Make a method alias for the existing method implementation, it not already copied.
const char *typeEncoding = method_getTypeEncoding(targetMethod);
SEL aliasSelector = aspect_aliasForSelector(selector);
Expand Down Expand Up @@ -191,7 +191,7 @@ static void aspect_cleanupHookedClassAndSelector(NSObject *self, SEL selector) {
// Check if the method is marked as forwarded and undo that.
Method targetMethod = class_getInstanceMethod(klass, selector);
IMP targetMethodIMP = method_getImplementation(targetMethod);
if (aspect_isMsgForwardIMP(targetMethodIMP)) {
if (!aspect_isMsgForwardIMP(targetMethodIMP)) {
// Restore the original method implementation.
const char *typeEncoding = method_getTypeEncoding(targetMethod);
SEL aliasSelector = aspect_aliasForSelector(selector);
Expand Down

0 comments on commit c12e11a

Please sign in to comment.