Repository: incubator-weex
Updated Branches:
  refs/heads/master a820eeb2f -> 162d70588


[Weex-398][iOS]Try to fix insert table view cell exception abort on iOS

close #1201


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/162d7058
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/162d7058
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/162d7058

Branch: refs/heads/master
Commit: 162d705883a4486318f308605fa094b7dec2a94a
Parents: a820eeb
Author: Xiaomin <caixiao...@yahoo.com>
Authored: Wed May 23 18:40:33 2018 +0800
Committer: acton393 <zhangxing610...@gmail.com>
Committed: Thu May 24 12:13:01 2018 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/162d7058/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm 
b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
index 854aa3a..e5a6123 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
@@ -923,6 +923,11 @@
 
 - (void)_insertTableViewCellAtIndexPath:(NSIndexPath *)indexPath 
keepScrollPosition:(BOOL)keepScrollPosition 
animation:(UITableViewRowAnimation)animation
 {
+    NSInteger numberOfRows = ((WXSectionComponent *)[_sections 
wx_safeObjectAtIndex:indexPath.section]).rows.count;
+    if (indexPath.row > numberOfRows || indexPath.row < 0) {
+        WXLogError(@"inserting cell at row %ld out of range in section:%ld", 
indexPath.row, indexPath.section);
+        return;
+    }
     [self _performUpdates:^{
         if ([_updataType  isEqual: @"reload"]) {
             [_tableView reloadData];

Reply via email to