diff options
-rw-r--r-- | platform/ios/src/UIColor+MGLAdditions.mm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/ios/src/UIColor+MGLAdditions.mm b/platform/ios/src/UIColor+MGLAdditions.mm index 33c690ae1a..1cf4db75f7 100644 --- a/platform/ios/src/UIColor+MGLAdditions.mm +++ b/platform/ios/src/UIColor+MGLAdditions.mm @@ -7,8 +7,14 @@ CGFloat r, g, b, a; [self getRed:&r green:&g blue:&b alpha:&a]; - - return { (float)[self cap_rgba:r], (float)[self cap_rgba:g], (float)[self cap_rgba:b], (float)[self cap_rgba:a] }; + for (NSNumber *num in @[@(r), @(g), @(b), @(a)]) { + if ((MAX(MIN(num.floatValue, 1), 0)) != num.floatValue) { + [NSException raise:NSInvalidArgumentException format:@""]; +// num = @0; + } + } + return { (float)r, (float)g, (float)b, (float)a }; +// return { (float)[self cap_rgba:r], (float)[self cap_rgba:g], (float)[self cap_rgba:b], (float)[self cap_rgba:a] }; } - (mbgl::style::PropertyValue<mbgl::Color>)mgl_colorPropertyValue |