[ios, macos] Fixed null expression crash
Convert NSNull into an mbgl null value.
This commit is contained in:
committed by
Minh Nguyễn
parent
077cbb5e4b
commit
2c62f0a15b
@@ -55,9 +55,10 @@
|
||||
// We use long long here to avoid any truncation.
|
||||
return { (int64_t)number.longLongValue };
|
||||
}
|
||||
} else if (value != [NSNull null]) {
|
||||
[NSException raise:@"Value not handled"
|
||||
format:@"Can’t convert %s:%@ to mbgl::Value", [value objCType], value];
|
||||
}
|
||||
[NSException raise:@"Value not handled"
|
||||
format:@"Can’t convert %s:%@ to mbgl::Value", [value objCType], value];
|
||||
return { };
|
||||
}
|
||||
|
||||
|
||||
@@ -197,4 +197,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Null Tests
|
||||
|
||||
- (void)testExpressionConversionNull
|
||||
{
|
||||
NSComparisonPredicate *predicate = [self equalityComparisonPredicateWithRightConstantValue:[NSNull null]];
|
||||
mbgl::Value convertedValue = predicate.rightExpression.mgl_filterValue;
|
||||
XCTAssertTrue(convertedValue.is<mbgl::NullValue>());
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user