Open alanchenboy opened 3 years ago
Platform: iOS Mapbox SDK version: Lastest 2022.2
If mgl_does:have: return True the App will crash.
Sample code :
NSExpression *expression = [NSExpression expressionForFunction:@"mgl_does:have:" arguments:@[MGLConstantExpression(@{@"x": MGLConstantExpression(@0)}), MGLConstantExpression(@"x")]]; BOOL b = [expression expressionValueWithObject:nil context:nil]; // crash here !!! b = true;
Does the NSExpression function "mgl_does:have" can use in this way? I think NSExpression function should return NSObject not BOOL.
Not crash.
Crash.
I think NSExpression function should return NSObject not BOOL.
I think you’re right, this should be returning an NSValue containing a Boolean, not a raw Boolean:
https://github.com/mapbox/mapbox-gl-native-ios/blob/57b231776bb3bf95b90b61cee707cdb8bab33e1a/platform/darwin/src/NSExpression%2BMGLAdditions.mm#L206-L208
Platform: iOS Mapbox SDK version: Lastest 2022.2
Steps to trigger behavior
If mgl_does:have: return True the App will crash.
Sample code :
Does the NSExpression function "mgl_does:have" can use in this way? I think NSExpression function should return NSObject not BOOL.
Expected behavior
Not crash.
Actual behavior
Crash.