abi, signer: fix nil dereference in #17633 (#17653)

* abi,signer: fix nil dereference in #17633

* signer/core: tiny typo fix in test error message
This commit is contained in:
Martin Holst Swende
2018-09-19 11:07:53 +02:00
committed by Péter Szilágyi
parent 0b477712a1
commit 16bc8741bf
2 changed files with 25 additions and 16 deletions

View File

@ -103,7 +103,12 @@ func NewType(t string) (typ Type, err error) {
return typ, err
}
// parse the type and size of the abi-type.
parsedType := typeRegex.FindAllStringSubmatch(t, -1)[0]
matches := typeRegex.FindAllStringSubmatch(t, -1)
if len(matches) == 0 {
return Type{}, fmt.Errorf("invalid type '%v'", t)
}
parsedType := matches[0]
// varSize is the size of the variable
var varSize int
if len(parsedType[3]) > 0 {