From bf09e80270b78cdea99ee13f89f6089f67beaeb1 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 26 May 2021 19:23:11 +0530 Subject: [PATCH] check if response exists --- libs/remix-lib/src/execution/txFormat.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/remix-lib/src/execution/txFormat.ts b/libs/remix-lib/src/execution/txFormat.ts index 62f90be1a8..6c32c0f531 100644 --- a/libs/remix-lib/src/execution/txFormat.ts +++ b/libs/remix-lib/src/execution/txFormat.ts @@ -357,14 +357,12 @@ export function decodeResponse (response, fnabi) { if (fnabi.outputs && fnabi.outputs.length > 0) { try { let i - const outputTypes = [] for (i = 0; i < fnabi.outputs.length; i++) { const type = fnabi.outputs[i].type outputTypes.push(type.indexOf('tuple') === 0 ? makeFullTypeDefinition(fnabi.outputs[i]) : type) } - - if (!response.length) response = new Uint8Array(32 * fnabi.outputs.length) // ensuring the data is at least filled by 0 cause `AbiCoder` throws if there's not engouh data + if (!response || !response.length) response = new Uint8Array(32 * fnabi.outputs.length) // ensuring the data is at least filled by 0 cause `AbiCoder` throws if there's not engouh data // decode data const abiCoder = new ethers.utils.AbiCoder() const decodedObj = abiCoder.decode(outputTypes, response)