Catch exceptions
This commit is contained in:
parent
b43f01ff4a
commit
4aeea82bc2
@ -62,8 +62,13 @@ export function hexToBech32(hrp, hex) {
|
||||
return "";
|
||||
}
|
||||
|
||||
let buf = secp.utils.hexToBytes(hex);
|
||||
return bech32.encode(hrp, bech32.toWords(buf));
|
||||
try {
|
||||
let buf = secp.utils.hexToBytes(hex);
|
||||
return bech32.encode(hrp, bech32.toWords(buf));
|
||||
} catch (e) {
|
||||
console.warn("Invalid hex", hex, e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user