From 3fc29b9ae4aaef02dbcbf7ece29cb07c78df1d27 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 20 Feb 2017 13:34:33 +0100 Subject: [PATCH] Handle invalid ABI retrieved from address_book gracefully (#4606) * 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 379617f34..da23f916c 100644 --- a/js/src/ui/MethodDecoding/methodDecodingStore.js +++ b/js/src/ui/MethodDecoding/methodDecodingStore.js @@ -54,9 +54,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; }