From ccbf041b2a38552286e479cd87bf0fb4d22b1097 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 10 Jan 2023 11:19:52 +0000 Subject: [PATCH] Bug fix #22 --- src/Util.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Util.js b/src/Util.js index 7096b794..737e3d60 100644 --- a/src/Util.js +++ b/src/Util.js @@ -58,6 +58,10 @@ export function eventLink(hex) { * @param {string} hex */ export function hexToBech32(hrp, hex) { + if (typeof hex !== "string" || hex.length === 0 || hex.length % 2 != 0) { + return null; + } + let buf = secp.utils.hexToBytes(hex); return bech32.encode(hrp, bech32.toWords(buf)); }