Commit 5ca197d0 authored by yann300's avatar yann300

fix enum

parent 9c7db6d2
...@@ -16,7 +16,11 @@ function Enum (enumDef) { ...@@ -16,7 +16,11 @@ function Enum (enumDef) {
Enum.prototype.decodeFromStorage = function (location, storageContent) { Enum.prototype.decodeFromStorage = function (location, storageContent) {
var value = util.extractHexByte(location, storageContent, this.storageBytes) var value = util.extractHexByte(location, storageContent, this.storageBytes)
value = parseInt(value) 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 module.exports = Enum
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment