pull/7/head
yann300 8 years ago
parent 9c7db6d20a
commit 5ca197d060
  1. 6
      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

Loading…
Cancel
Save