From 73cd95f1ff9b14c509289179ba9395bbc90d4c3a Mon Sep 17 00:00:00 2001 From: Elizaveta Semenova Date: Mon, 15 Jan 2024 11:46:30 +0400 Subject: [PATCH] Fix empty name in case of lookup request data race --- p2p_wallet/Scenes/TabBar/TabBarViewModel.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/p2p_wallet/Scenes/TabBar/TabBarViewModel.swift b/p2p_wallet/Scenes/TabBar/TabBarViewModel.swift index 6a08342c62..fb3885b7b2 100644 --- a/p2p_wallet/Scenes/TabBar/TabBarViewModel.swift +++ b/p2p_wallet/Scenes/TabBar/TabBarViewModel.swift @@ -37,8 +37,9 @@ final class TabBarViewModel { // Name service Task { guard let account = accountStorage.account else { return } - let name: String = try await nameService.getName(account.publicKey.base58EncodedString, withTLD: true) ?? "" - nameStorage.save(name: name) + if let name = try await nameService.getName(account.publicKey.base58EncodedString, withTLD: true) { + nameStorage.save(name: name) + } } // Notification