* [ios] try to fix out of range exception

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

Branch: refs/heads/0.16-dev
Commit: 7941d02f173250aeff56896a5f72ef75f608db42
Parents: cc56cb3
Author: acton393 <zhangxing610...@gmail.com>
Authored: Tue Sep 5 16:56:16 2017 +0800
Committer: acton393 <zhangxing610...@gmail.com>
Committed: Tue Sep 5 16:56:16 2017 +0800

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


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7941d02f/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m 
b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index 4db1c2f..cb9237f 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -444,6 +444,10 @@
     NSIndexPath *indexPath = [self indexPathForSubIndex:index];
 
     NSInteger sectionNum = indexPath.section;
+    if (sectionNum >= [_sections count] || sectionNum < 0) {
+        // try to protect sectionNum out of range.
+        return;
+    }
     NSInteger row = indexPath.row;
     NSMutableArray *sections = _sections;
     WXSectionComponent *section = sections[sectionNum];

Reply via email to