Fix more possible JobMigration crashes.

This commit is contained in:
Greyson Parrelli 2019-09-25 15:19:08 -04:00
parent c5767b07a7
commit e273593343

View File

@ -47,7 +47,7 @@ public class RecipientIdJobMigration extends JobMigration {
}
private @NonNull JobData migrateMultiDeviceContactUpdateJob(@NonNull JobData jobData) {
String address = jobData.getData().getString("address");
String address = jobData.getData().hasString("address") ? jobData.getData().getString("address") : null;
Data updatedData = new Data.Builder().putString("recipient", address != null ? Recipient.external(application, address).getId().serialize() : null)
.putBoolean("force_sync", jobData.getData().getBoolean("force_sync"))
.build();
@ -109,7 +109,7 @@ public class RecipientIdJobMigration extends JobMigration {
private @NonNull JobData migratePushGroupSendJob(@NonNull JobData jobData) {
// noinspection ConstantConditions
Recipient queueRecipient = Recipient.external(application, jobData.getQueueKey());
String address = jobData.getData().getString("filter_address");
String address = jobData.getData().hasString("filter_address") ? jobData.getData().getString("filter_address") : null;
RecipientId recipientId = address != null ? Recipient.external(application, address).getId() : null;
Data updatedData = new Data.Builder().putString("filter_recipient", recipientId != null ? recipientId.serialize() : null)
.putLong("message_id", jobData.getData().getLong("message_id"))
@ -130,7 +130,7 @@ public class RecipientIdJobMigration extends JobMigration {
}
private @NonNull JobData migrateDirectoryRefreshJob(@NonNull JobData jobData) {
String address = jobData.getData().getString("address");
String address = jobData.getData().hasString("address") ? jobData.getData().getString("address") : null;
Recipient recipient = address != null ? Recipient.external(application, address) : null;
Data updatedData = new Data.Builder().putString("recipient", recipient != null ? recipient.getId().serialize() : null)
.putBoolean("notify_of_new_users", jobData.getData().getBoolean("notify_of_new_users"))