summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/darwin/src/NSExpression+MGLAdditions.mm5
-rw-r--r--platform/darwin/test/MGLExpressionTests.mm9
2 files changed, 12 insertions, 2 deletions
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm
index 392a6d7f5b..6af069487e 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 971f7d0e54..e78f87a99b 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<mbgl::NullValue>());
+}
+
@end