From 5ca197d0603edcde02b90ff9cc0a76e56417d226 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 24 Nov 2016 14:46:40 +0100 Subject: [PATCH] fix enum --- src/solidity/types/Enum.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/solidity/types/Enum.js b/src/solidity/types/Enum.js index 81873eee01..9687466bbc 100644 --- a/src/solidity/types/Enum.js +++ b/src/solidity/types/Enum.js @@ -16,7 +16,11 @@ function Enum (enumDef) { Enum.prototype.decodeFromStorage = function (location, storageContent) { var value = util.extractHexByte(location, storageContent, this.storageBytes) value = parseInt(value) - return this.enumDef.children[value].attributes.name + if (this.enumDef.children.length > value) { + return this.enumDef.children[value].attributes.name + } else { + return 'INVALID_ENUM<' + value + '>' + } } module.exports = Enum