Marino Faggiana 7 years ago
parent
commit
6dc3027d69
2 changed files with 8 additions and 4 deletions
  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;
 }