Browse Source

be more careful with the index to groupMemberIds

memberManagementRows may grow now,
however, usually together with groupMemberIds,
so, this is only a general precaution.

the change results in passing 0 as contact_id around in case of errors,
however, this is fine, core will take care of it
(will result in 'careless calls' warnings).
B. Petersen 3 years ago
parent
commit
68f679b2c5
1 changed files with 6 additions and 1 deletions
  1. 6 1
      deltachat-ios/Controller/GroupChatDetailViewController.swift

+ 6 - 1
deltachat-ios/Controller/GroupChatDetailViewController.swift

@@ -354,7 +354,12 @@ class GroupChatDetailViewController: UIViewController {
      }
 
     private func getGroupMemberIdFor(_ row: Int) -> Int {
-        return groupMemberIds[row - memberManagementRows]
+        let index = row - memberManagementRows
+        if index >= 0 && index < groupMemberIds.count {
+            return groupMemberIds[index]
+        } else {
+            return 0
+        }
     }
 
     private func isMemberManagementRow(row: Int) -> Bool {