NSExpression addition "mgl_does:have:" can't evaluates !
alanchenboy opened this issue · 1 comments
alanchenboy commented
Platform: iOS
Mapbox SDK version: Lastest 2022.2
Steps to trigger behavior
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.
Expected behavior
Not crash.
Actual behavior
1ec5 commented
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:
mapbox-gl-native-ios/platform/darwin/src/NSExpression+MGLAdditions.mm
Lines 206 to 208 in 57b2317