aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2018-09-19 17:07:53 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-09-19 17:07:53 +0800
commit16bc8741bfc6db6d7d352015e4324042dd9288a4 (patch)
treecd2f1b8e06c0f24e2458ac9a97001d1d4ebe9169 /accounts
parent0b477712a1d8abb478b5bb00ec103e0bf100c8da (diff)
downloaddexon-16bc8741bfc6db6d7d352015e4324042dd9288a4.tar.gz
dexon-16bc8741bfc6db6d7d352015e4324042dd9288a4.tar.zst
dexon-16bc8741bfc6db6d7d352015e4324042dd9288a4.zip
abi, signer: fix nil dereference in #17633 (#17653)
* abi,signer: fix nil dereference in #17633 * signer/core: tiny typo fix in test error message
Diffstat (limited to 'accounts')
-rw-r--r--accounts/abi/type.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/accounts/abi/type.go b/accounts/abi/type.go
index 9de36daff..dce89d2b4 100644
--- a/accounts/abi/type.go
+++ b/accounts/abi/type.go
@@ -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 {