From 7df702494dd199622bb1f96a88f82d49b10932fa Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 20 Feb 2017 13:48:23 +0100 Subject: [PATCH] Handle invalid ABI retrieved from address_book gracefully (#4606) (#4610) * Handle invalid ABI gracefully * Also include failed abi in log --- js/src/ui/MethodDecoding/methodDecodingStore.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/src/ui/MethodDecoding/methodDecodingStore.js b/js/src/ui/MethodDecoding/methodDecodingStore.js index 01f3a635c1d..d492aabee65 100644 --- a/js/src/ui/MethodDecoding/methodDecodingStore.js +++ b/js/src/ui/MethodDecoding/methodDecodingStore.js @@ -55,9 +55,19 @@ export default class MethodDecodingStore { } loadFromAbi (_abi, contractAddress) { - const abi = new Abi(_abi); + let abi; - if (contractAddress && abi) { + try { + abi = new Abi(_abi); + } catch (error) { + console.warn('loadFromAbi', error, _abi); + } + + if (!abi) { + return; + } + + if (contractAddress) { this._contractsAbi[contractAddress] = abi; }