kopia lustrzana https://github.com/ryukoposting/Signal-Android
Prevent crash on clients with bad data.
rodzic
041bde3fd9
commit
a845a020d6
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue