From 32afbb373cd138a921f127f0f85ea0c860025f41 Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Mon, 4 Apr 2022 15:51:15 +0200 Subject: [PATCH] fix(cosmos-provider): handle possibly undefined `address` --- dapps/react-dapp-v2-cosmos-provider/src/App.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dapps/react-dapp-v2-cosmos-provider/src/App.tsx b/dapps/react-dapp-v2-cosmos-provider/src/App.tsx index db1bedb..7233fc4 100644 --- a/dapps/react-dapp-v2-cosmos-provider/src/App.tsx +++ b/dapps/react-dapp-v2-cosmos-provider/src/App.tsx @@ -123,6 +123,10 @@ export default function App() { const address = account.split(":").pop(); + if (!address) { + throw new Error(`Could not derive address from account: ${account}`); + } + // cosmos_signDirect params const params = { signerAddress: address, @@ -161,6 +165,10 @@ export default function App() { const address = account.split(":").pop(); + if (!address) { + throw new Error(`Could not derive address from account: ${account}`); + } + // cosmos_signAmino params const params = { signerAddress: address, signDoc };