From 15c33e75189c963f6bdf0fa8714888157a42ce01 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 9 Nov 2016 17:01:17 +0100 Subject: [PATCH] add more null test --- src/solidity/decodeInfo.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/solidity/decodeInfo.js b/src/solidity/decodeInfo.js index 3d30211f47..20ed46d44c 100644 --- a/src/solidity/decodeInfo.js +++ b/src/solidity/decodeInfo.js @@ -181,6 +181,7 @@ function Struct (type, stateDefinitions) { return null } var memberDetails = getStructMembers(match[1], stateDefinitions) // type is used to extract the ast struct definition + if (!memberDetails) return null return { needsFreeStorageSlot: true, storageBytes: memberDetails.storageBytes, @@ -224,7 +225,7 @@ function getStructMembers (typeName, stateDefinitions) { var decoded = decode(member.attributes.type, stateDefinitions) if (!decoded) { console.log('unable to retrieve decode info of ' + member.attributes.type) - continue + return null } members.push(decoded) if (decoded.needsFreeStorageSlot) { @@ -263,7 +264,7 @@ function typeClass (fullType) { * * @param {Object} type - type name given by the ast node * @param {Object} stateDefinitions - all state stateDefinitions given by the AST (including struct and enum type declaration) - * @return {Object} - return the corresponding decoder + * @return {Object} - return the corresponding decoder or null on error */ function decode (type, stateDefinitions) { var decodeInfos = {