Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Whoops. Thanks @DGh0st

Also fix a build issue, a typo in some macros
  • Loading branch information
NSExceptional committed Sep 15, 2019
1 parent f64e6ec commit 0803b46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ + (UIViewController *)imagePreviewViewControllerForView:(UIView *)view

#pragma mark - Runtime Adjustment

#define PropertyKey(suffix) kFLEXPropertyAttributeKey##suffix : @""
#define PropertyKeyGetter(getter) kFLEXPropertyAttributeKeyCustomGetter : NSStringFromSelector(@selector(getter))
#define PropertyKeySetter(setter) kFLEXPropertyAttributeKeyCustomSetter : NSStringFromSelector(@selector(setter))
#define PropertyKey(suffix) kFLEXUtilityAttribute##suffix : @""
#define PropertyKeyGetter(getter) kFLEXUtilityAttributeCustomGetter : NSStringFromSelector(@selector(getter))
#define PropertyKeySetter(setter) kFLEXUtilityAttributeCustomSetter : NSStringFromSelector(@selector(setter))

#define FLEXRuntimeUtilityTryAddProperty(iOS_atLeast, name, cls, type, ...) ({ \
if (@available(iOS iOS_atLeast, *)) { \
NSMutableDictionary *attrs = [NSMutableDictionary dictionaryWithDictionary:@{ \
kFLEXPropertyAttributeKeyTypeEncoding : @(type), \
kFLEXUtilityAttributeTypeEncoding : @(type), \
__VA_ARGS__ \
}]; \
[FLEXRuntimeUtility \
Expand Down
7 changes: 4 additions & 3 deletions Classes/Utility/FLEXRuntimeUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ + (id)performSelector:(SEL)selector
//
// returnType = method_getTypeEncoding(class_getInstanceMethod([object class], selector));
NSMethodSignature *methodSignature = [object methodSignatureForSelector:selector];
if (!methodSignature.methodReturnLength) {
if (!methodSignature.methodReturnLength &&
methodSignature.methodReturnType[0] != FLEXTypeEncodingVoid) {
return nil;
}

Expand Down Expand Up @@ -493,10 +494,9 @@ + (id)performSelector:(SEL)selector
NSGetSizeAndAlignment(typeEncodingCString, &bufferSize, NULL);

if (bufferSize > 0) {
void *buffer = calloc(bufferSize, 1);
void *buffer = alloca(bufferSize);
[argumentValue getValue:buffer];
[invocation setArgument:buffer atIndex:argumentIndex];
free(buffer);
}
} @catch (NSException *exception) { }
}
Expand All @@ -506,6 +506,7 @@ + (id)performSelector:(SEL)selector
// Try to invoke the invocation but guard against an exception being thrown.
id returnObject = nil;
@try {
[invocation invoke];

// Retrieve the return value and box if necessary.
const char *returnType = methodSignature.methodReturnType;
Expand Down

0 comments on commit 0803b46

Please sign in to comment.