damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 3277aac220f13b0c132f30c8e9f645c2b67524c0
parent e67dac13c6b8816c88c2217352cb5972fbbf5836
Author: William Casarin <jb55@jb55.com>
Date:   Wed,  7 Jun 2023 06:50:02 +0200

refactor: use guard in qr profile lookup

Diffstat:
Mdamus/Views/QRCodeView.swift | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/damus/Views/QRCodeView.swift b/damus/Views/QRCodeView.swift @@ -237,8 +237,10 @@ struct QRCodeView: View { } func profile(for code: String) -> Profile? { - let decoded = try? bech32_decode(code) - let hex = hex_encode(decoded!.data) + guard let decoded = try? bech32_decode(code) else { + return nil + } + let hex = hex_encode(decoded.data) return damus_state.profiles.lookup(id: hex) }