1
0
mirror of git://jb55.com/damus synced 2024-09-29 08:20:45 +00:00

txn: fix potential crash from transaction in view closure

This commit is contained in:
William Casarin 2024-01-29 12:50:12 -08:00
parent ff6b19578e
commit f5f42528af

View File

@ -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())