Fix problem with prefetched recipient details

Don't use a cached recipient if we have a prefetched recipient
detail object and the cached recipient is still in progress
and without a name

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2017-09-06 00:11:11 -07:00
parent 79f8cf8e35
commit efc4a5ab9d

View File

@ -72,7 +72,8 @@ class RecipientProvider {
@NonNull Recipient getRecipient(Context context, Address address, Optional<RecipientSettings> settings, Optional<GroupRecord> groupRecord, boolean asynchronous) {
Recipient cachedRecipient = recipientCache.get(address);
if (cachedRecipient != null && !cachedRecipient.isStale() && (asynchronous || !cachedRecipient.isResolving())) {
if (cachedRecipient != null && !cachedRecipient.isStale() && (asynchronous || !cachedRecipient.isResolving()) && ((!groupRecord.isPresent() && !settings.isPresent()) || !cachedRecipient.isResolving() || cachedRecipient.getName() != null)) {
return cachedRecipient;
}