mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Prevent crash on clients with bad data.
This commit is contained in:
@@ -8,8 +8,12 @@ import org.thoughtcrime.securesms.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Marks all distribution lists as needing to be synced with storage service.
|
||||
*/
|
||||
@@ -48,7 +52,21 @@ public final class SyncDistributionListsMigrationJob extends MigrationJob {
|
||||
Log.i(TAG, "Stories capability is not supported.");
|
||||
}
|
||||
|
||||
SignalDatabase.recipients().markNeedsSync(SignalDatabase.distributionLists().getAllListRecipients());
|
||||
List<RecipientId> listRecipients = SignalDatabase.distributionLists()
|
||||
.getAllListRecipients()
|
||||
.stream()
|
||||
.filter(id -> {
|
||||
try {
|
||||
Recipient.resolved(id);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Unable to resolve distribution list recipient: " + id, e);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
SignalDatabase.recipients().markNeedsSync(listRecipients);
|
||||
StorageSyncHelper.scheduleSyncForDataChange();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user