Quick fix missing username bug

pull/369/head
Niels Andriesse 4 years ago
parent e170bfedf1
commit 76e5515610

@ -40,6 +40,16 @@ extension Storage {
var result: Contact?
Storage.read { transaction in
result = Storage.shared.getContact(with: userPublicKey)
// HACK: Apparently it's still possible for the user's contact info to be missing
if result == nil, let profile = OWSUserProfile.fetch(uniqueId: kLocalProfileUniqueId, transaction: transaction),
let userPublicKey = Storage.shared.getUserPublicKey() {
let user = Contact(sessionID: userPublicKey)
user.name = profile.profileName
user.profilePictureURL = profile.avatarUrlPath
user.profilePictureFileName = profile.avatarFileName
user.profilePictureEncryptionKey = profile.profileKey
result = user
}
}
return result
}

Loading…
Cancel
Save