From 5113d73b3782971bda49ef2015cb4d4df091c2d4 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Mon, 13 Jul 2020 11:25:04 +0800 Subject: [PATCH] fix:iOS ListNode item index outof range --- doric-iOS/Pod/Classes/Shader/DoricListNode.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doric-iOS/Pod/Classes/Shader/DoricListNode.m b/doric-iOS/Pod/Classes/Shader/DoricListNode.m index a7dc0b5d..c11a72f2 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricListNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricListNode.m @@ -226,10 +226,13 @@ - (void)callItem:(NSUInteger)position height:(CGFloat)height { return; } self.itemHeights[@(position)] = @(height); - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:position inSection:0]; if (@available(iOS 10.0, *)) { dispatch_async(dispatch_get_main_queue(), ^{ [UIView performWithoutAnimation:^{ + if([self.view numberOfRowsInSection:0]<=position){ + return; + } + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:position inSection:0]; [self.view reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone]; }]; });