Marino Faggiana 7 年之前
父節點
當前提交
6dc3027d69
共有 2 個文件被更改,包括 8 次插入4 次删除
  1. 4 2
      iOSClient/Main/CCMain.m
  2. 4 2
      iOSClient/Photos/CCPhotos.m

+ 4 - 2
iOSClient/Main/CCMain.m

@@ -5681,12 +5681,14 @@
     
     NSInteger lastSectionIndex = [self numberOfSectionsInTableView:self.tableView] - 1;
     
-    //Make sure the specified section exists
-    if (section > lastSectionIndex)
+    if (section > lastSectionIndex || lastSectionIndex < 0)
         return NO;
     
     NSInteger rowCount = [self.tableView numberOfRowsInSection:indexPath.section] - 1;
     
+    if (rowCount < 0)
+        return NO;
+    
     return row <= rowCount;
 }
 

+ 4 - 2
iOSClient/Photos/CCPhotos.m

@@ -679,12 +679,14 @@
     
     NSInteger lastSectionIndex = [self numberOfSectionsInCollectionView:self.collectionView] - 1;
     
-    //Make sure the specified section exists
-    if (section > lastSectionIndex)
+    if (section > lastSectionIndex || lastSectionIndex < 0)
         return NO;
     
     NSInteger rowCount = [self.collectionView numberOfItemsInSection:indexPath.section] - 1;
     
+    if (rowCount < 0)
+        return NO;
+    
     return row <= rowCount;
 }