Fix possible crash in ProfileKeySendJob if given an invalid threadId.

This commit is contained in:
Greyson Parrelli
2022-07-01 11:06:37 -04:00
parent e413ee4ed9
commit be2ed8989f
5 changed files with 20 additions and 10 deletions

View File

@@ -325,10 +325,14 @@ public final class MessageContentProcessor {
.enqueue();
} else if (!threadRecipient.isGroup()) {
Log.i(TAG, "Message was to a 1:1. Ensuring this user has our profile key.");
ApplicationDependencies.getJobManager()
.startChain(new RefreshAttributesJob(false))
.then(ProfileKeySendJob.create(context, SignalDatabase.threads().getOrCreateThreadIdFor(threadRecipient), true))
.enqueue();
ProfileKeySendJob profileSendJob = ProfileKeySendJob.create(SignalDatabase.threads().getOrCreateThreadIdFor(threadRecipient), true);
if (profileSendJob != null) {
ApplicationDependencies.getJobManager()
.startChain(new RefreshAttributesJob(false))
.then(profileSendJob)
.enqueue();
}
}
}
}