aboutsummaryrefslogtreecommitdiffstats
path: root/common/hexutil/json.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-01-13 16:45:40 +0800
committerGitHub <noreply@github.com>2017-01-13 16:45:40 +0800
commit01f6f2d741e717f669b7ba1d6b88991f28e30c72 (patch)
treef87ea1219834c44cd2e8ab6a64da9c49edef37cb /common/hexutil/json.go
parentc5df37c1119107ddcc517127b3bd7c2ab4e3649f (diff)
downloaddexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.tar.gz
dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.tar.zst
dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.zip
common/hexutil: allow empty strings when decoding JSON (#3559)
Diffstat (limited to 'common/hexutil/json.go')
-rw-r--r--common/hexutil/json.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/hexutil/json.go b/common/hexutil/json.go
index cbbadbed6..c36d862b5 100644
--- a/common/hexutil/json.go
+++ b/common/hexutil/json.go
@@ -237,7 +237,7 @@ func checkJSON(input []byte) (raw []byte, err error) {
return nil, errNonString
}
if len(input) == 2 {
- return nil, ErrEmptyString
+ return nil, nil // empty strings are allowed
}
if !bytesHave0xPrefix(input[1:]) {
return nil, ErrMissingPrefix
@@ -255,7 +255,7 @@ func checkNumberJSON(input []byte) (raw []byte, err error) {
}
input = input[1 : len(input)-1]
if len(input) == 0 {
- return nil, ErrEmptyString
+ return nil, nil // empty strings are allowed
}
if !bytesHave0xPrefix(input) {
return nil, ErrMissingPrefix