Fix crash when searching groups for a large number of members.

fork-5.53.8
Greyson Parrelli 2022-08-25 14:26:17 -04:00
rodzic d0c737779a
commit f551a700fe
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -299,6 +299,11 @@ public class GroupDatabase extends Database {
return new Reader(null);
}
if (recipientIds.size() > 30) {
Log.w(TAG, "[queryGroupsByMembership] Large set of recipientIds (" + recipientIds.size() + ")! Using the first 30.");
recipientIds = recipientIds.stream().limit(30).collect(Collectors.toSet());
}
List<String> recipientLikeClauses = recipientIds.stream()
.map(RecipientId::toLong)
.map(id -> "(" + MEMBERS + " LIKE " + id + " || ',%' OR " + MEMBERS + " LIKE '%,' || " + id + " || ',%' OR " + MEMBERS + " LIKE '%,' || " + id + ")")