From 20d0d162b591165c8ed654a29703c64873af62f6 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Mon, 22 Mar 2021 13:27:52 +0100 Subject: [PATCH] fix(Contacts): ensure app doesn't crash when contact can't be resolved There was a bug introduced https://github.com/status-im/status-desktop/commit/2ac67f95a where we'd rely on the possibly resolved public key, which is passed to `generateAlias()`. The public key is never guaranteed to be an actual key (if resolution fails, it's a an empty string). Passing an empty string to `generateAlias()` causes `status-go` to crash and we don't handle that error. This commit ensures that we only attempt to generate an alias when we indeed have a successfully resolved public key. --- src/app/profile/views/contacts.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/profile/views/contacts.nim b/src/app/profile/views/contacts.nim index 37493dda61..89e36086de 100644 --- a/src/app/profile/views/contacts.nim +++ b/src/app/profile/views/contacts.nim @@ -123,6 +123,10 @@ QtObject: proc ensResolved(self: ContactsView, id: string) {.slot.} = self.ensWasResolved(id) + if id == "": + self.contactToAddChanged() + return + let contact = self.status.contacts.getContactByID(id) if contact != nil: