From f5f42528afe1b7bf8ac4c8cbc4e64f322474a26a Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 29 Jan 2024 12:50:12 -0800 Subject: [PATCH] txn: fix potential crash from transaction in view closure --- damus/Views/SideMenuView.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/damus/Views/SideMenuView.swift b/damus/Views/SideMenuView.swift index dfc04313..d82d5698 100644 --- a/damus/Views/SideMenuView.swift +++ b/damus/Views/SideMenuView.swift @@ -89,13 +89,14 @@ struct SideMenuView: View { } var TopProfile: some View { - let profile_txn = damus_state.ndb.lookup_profile(damus_state.pubkey, txn_name: "top_profile") - let profile = profile_txn?.unsafeUnownedValue?.profile return VStack(alignment: .leading, spacing: verticalSpacing) { HStack { ProfilePicView(pubkey: damus_state.pubkey, size: 60, highlight: .none, profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation) VStack(alignment: .leading) { + let profile_txn = damus_state.ndb.lookup_profile(damus_state.pubkey, txn_name: "top_profile") + let profile = profile_txn?.nsafeUnownedValue?.profile + if let display_name = profile?.display_name { Text(display_name) .foregroundColor(textColor())