From 32c4fcb06587cb991e7f4a0b5a9f380ae1050de8 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli <greyson@signal.org> Date: Tue, 19 Apr 2022 12:28:08 -0400 Subject: [PATCH] Improve handling of empty profiles. --- .../thoughtcrime/securesms/jobs/RetrieveProfileJob.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/RetrieveProfileJob.java b/app/src/main/java/org/thoughtcrime/securesms/jobs/RetrieveProfileJob.java index d6358a7cb4..49663d2240 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/RetrieveProfileJob.java +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/RetrieveProfileJob.java @@ -451,6 +451,11 @@ public class RetrieveProfileJob extends BaseJob { String plaintextProfileName = Util.emptyIfNull(ProfileUtil.decryptString(profileKey, profileName)); + if (TextUtils.isEmpty(plaintextProfileName)) { + Log.w(TAG, "No name set on the profile for " + recipient.getId() + " -- Leaving it alone"); + return; + } + ProfileName remoteProfileName = ProfileName.fromSerialized(plaintextProfileName); ProfileName localProfileName = recipient.getProfileName(); @@ -474,10 +479,6 @@ public class RetrieveProfileJob extends BaseJob { recipient.isBlocked(), recipient.isGroup(), recipient.isSelf(), localDisplayName.isEmpty(), !remoteDisplayName.equals(localDisplayName))); } } - - if (TextUtils.isEmpty(plaintextProfileName)) { - Log.i(TAG, "No profile name set for " + recipient.getId()); - } } catch (InvalidCiphertextException e) { Log.w(TAG, "Bad profile key for " + recipient.getId()); } catch (IOException e) { -- GitLab