Skip to content

Commit

Permalink
Makes decodeParameters return an empty array instead of throwing an e…
Browse files Browse the repository at this point in the history
…rror if input data is empty
  • Loading branch information
Anaphase committed Apr 15, 2019
1 parent 7766ece commit aeccb31
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/web3-eth-abi/src/AbiCoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ export default class AbiCoder {
*/
decodeParameters(outputs, bytes) {
if (isArray(outputs) && outputs.length === 0) {
if (bytes !== '0x' || bytes !== '0x0') {
return [];
}
throw new Error('Empty outputs array given!');
}

Expand Down Expand Up @@ -229,7 +232,7 @@ export default class AbiCoder {
nonIndexedInputItems.push(input);
});

if (data && data !== '0x' && data !== '0x0') {
if (data) {
let values = this.decodeParameters(nonIndexedInputItems, data);

let decodedValue;
Expand Down

0 comments on commit aeccb31

Please sign in to comment.