diff --git a/src/element/Invoice.js b/src/element/Invoice.js index ecee7766..ecf29d97 100644 --- a/src/element/Invoice.js +++ b/src/element/Invoice.js @@ -1,18 +1,20 @@ import "./Invoice.css"; import { decode as invoiceDecode } from "light-bolt11-decoder"; import { useMemo } from "react"; -import { useNavigate } from "react-router-dom"; export default function Invoice(props) { const invoice = props.invoice; - const navigate = useNavigate(); const info = useMemo(() => { - let parsed = invoiceDecode(invoice); + try { + let parsed = invoiceDecode(invoice); - let amount = parseInt(parsed.sections.find(a => a.name === "amount")?.value); - return { - amount: !isNaN(amount) ? (amount / 1000) : null + let amount = parseInt(parsed.sections.find(a => a.name === "amount")?.value); + return { + amount: !isNaN(amount) ? (amount / 1000) : null + } + } catch (e) { + console.error(e); } }, [invoice]);