refactor: use guard in qr profile lookup

This commit is contained in:
William Casarin
2023-06-07 06:50:02 +02:00
parent e67dac13c6
commit 3277aac220

View File

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