refactor: use guard in qr profile lookup
This commit is contained in:
@@ -237,8 +237,10 @@ struct QRCodeView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func profile(for code: String) -> Profile? {
|
func profile(for code: String) -> Profile? {
|
||||||
let decoded = try? bech32_decode(code)
|
guard let decoded = try? bech32_decode(code) else {
|
||||||
let hex = hex_encode(decoded!.data)
|
return nil
|
||||||
|
}
|
||||||
|
let hex = hex_encode(decoded.data)
|
||||||
return damus_state.profiles.lookup(id: hex)
|
return damus_state.profiles.lookup(id: hex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user