Skip to content

Force unwrap error on notification service target #3141

@linear

Description

@linear
let sender_profile = {
            let txn = state.ndb.lookup_profile(nostr_event.pubkey)
            let profile = txn?.unsafeUnownedValue?.profile
            let picture = ((profile?.picture.map { URL(string: $0) }) ?? URL(string: robohash(nostr_event.pubkey)))!  // <-- Force unwrap error happens here
            return ProfileBuf(picture: picture,
                                 name: profile?.name,
                         display_name: profile?.display_name,
                                nip05: profile?.nip05)
        }()

As of the past two weeks leading up to 2025-07-16, this is the 4th most common crash.

We should update this portion of code to handle nil safely.

Metadata

Metadata

Assignees

Labels

bugSomething is not working, or not working as intended

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions