diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index 392a6d7f5..6af069487 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -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 { }; } diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index 971f7d0e5..e78f87a99 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -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()); +} + @end