diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/DeleteMessagesBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/DeleteMessagesBottomSheet.java index 41a40683f9..f523fbbe67 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/DeleteMessagesBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/DeleteMessagesBottomSheet.java @@ -253,13 +253,9 @@ void forEach(Utilities.IndexedConsumer action) { } } - boolean checkOption(TLObject object) { - for (int i = 0; i < totalCount; i++) { - if (object == options.get(i)) { - return checks[i] && (filter == null || filter[i]); - } - } - return false; + boolean checkOption(int i) { + if (i > totalCount) return false; + return checks[i] && (filter == null || filter[i]); } } @@ -1009,8 +1005,8 @@ private void performDelete() { applyInCommonGroup.forEachSelected((participant, i) -> { if (participant instanceof TLRPC.User) { - boolean needBan = banOrRestrict.checkOption(participant); - boolean needDelete = banOrRestrict.checkOption(participant); + boolean needBan = banOrRestrict.checkOption(i); + boolean needDelete = deleteAll.checkOption(i); if (!needBan && !needDelete) { return; } @@ -1034,9 +1030,9 @@ private void performDelete() { if (canBan && needBan) { if (restrict) { TLRPC.TL_chatBannedRights rights = bannedRightsOr(bannedRights, participantsBannedRights.get(i)); - MessagesController.getInstance(currentAccount).setParticipantBannedRole(chat_.id, (TLRPC.User) participant, null, rights, false, getBaseFragment()); + MessagesController.getInstance(currentAccount).setParticipantBannedRole(chat_.id, userFinal, null, rights, false, getBaseFragment()); } else { - MessagesController.getInstance(currentAccount).deleteParticipantFromChat(chat_.id, (TLRPC.User) participant, null, false, false); + MessagesController.getInstance(currentAccount).deleteParticipantFromChat(chat_.id, userFinal, null, false, false); } } if (canDelete && needDelete) {