From d060e1427c9c056cbee6bc94dac6f9f015a5c960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Sat, 9 May 2020 11:31:00 +0800 Subject: [PATCH] iOS: ensure start & end are not nil --- doric-iOS/Pod/Classes/Shader/DoricViewNode.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doric-iOS/Pod/Classes/Shader/DoricViewNode.m b/doric-iOS/Pod/Classes/Shader/DoricViewNode.m index 0529a91e..e1bb7951 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricViewNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricViewNode.m @@ -348,11 +348,13 @@ - (void)requestLayout { [colors addObject:(__bridge id) DoricColor(obj).CGColor]; }]; } else { - UIColor *start = DoricColor(dict[@"start"]); - UIColor *end = DoricColor(dict[@"end"]); - - [colors addObject:(__bridge id) start.CGColor]; - [colors addObject:(__bridge id) end.CGColor]; + if ([dict objectForKey:@"start"] != nil && [dict objectForKey:@"end"] != nil) { + UIColor *start = DoricColor(dict[@"start"]); + UIColor *end = DoricColor(dict[@"end"]); + + [colors addObject:(__bridge id) start.CGColor]; + [colors addObject:(__bridge id) end.CGColor]; + } } int orientation = [dict[@"orientation"] intValue];