diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2019-03-20 10:49:23 -0700 |
---|---|---|
committer | Alf Watt <alf.watt@mapbox.com> | 2019-03-21 12:25:11 -0700 |
commit | 882aceae2f202e9ea40e29efaa8a19ab4577e6ec (patch) | |
tree | c19b66e9a4a5e729cbf3d5ac584a988593965942 /platform/darwin/src/NSExpression+MGLAdditions.mm | |
parent | 583e2cd5fc37329fdac933be1a513336029834d1 (diff) | |
download | qtlocation-mapboxgl-882aceae2f202e9ea40e29efaa8a19ab4577e6ec.tar.gz |
[ios, macos] Fix format expression parsing. (#14168)
Fixed a parsing issue when a non-constant expression was passed to MGLAttributedExpression.expression property.
Diffstat (limited to 'platform/darwin/src/NSExpression+MGLAdditions.mm')
-rw-r--r-- | platform/darwin/src/NSExpression+MGLAdditions.mm | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index f0f1d62ef7..091f1edf9d 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -1016,14 +1016,10 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { if ([constantValue isKindOfClass:[MGLAttributedExpression class]]) { MGLAttributedExpression *attributedExpression = (MGLAttributedExpression *)constantValue; id jsonObject = attributedExpression.expression.mgl_jsonExpressionObject; - NSMutableArray *attributes = [NSMutableArray array]; - if ([jsonObject isKindOfClass:[NSArray class]]) { - [attributes addObjectsFromArray:jsonObject]; - } else { - [attributes addObject:jsonObject]; - } + NSMutableDictionary *attributedDictionary = [NSMutableDictionary dictionary]; + if (attributedExpression.attributes) { - NSMutableDictionary *attributedDictionary = [NSMutableDictionary dictionaryWithDictionary:attributedExpression.attributes]; + attributedDictionary = [NSMutableDictionary dictionaryWithDictionary:attributedExpression.attributes]; if (attributedDictionary[MGLFontNamesAttribute]) { attributedDictionary[MGLFontNamesAttribute] = @[@"literal", attributedDictionary[MGLFontNamesAttribute]]; } @@ -1031,12 +1027,8 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { MGLColor *color = attributedDictionary[MGLFontColorAttribute]; attributedDictionary[MGLFontColorAttribute] = color.mgl_jsonExpressionObject; } - [attributes addObject:attributedDictionary]; - } else { - [attributes addObject:@{}]; - } - - return attributes; + } + return @[jsonObject, attributedDictionary]; } return self.constantValue; } |