aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/admin_args.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/api/admin_args.go')
-rw-r--r--rpc/api/admin_args.go32
1 files changed, 17 insertions, 15 deletions
diff --git a/rpc/api/admin_args.go b/rpc/api/admin_args.go
index e7548c7be..532907905 100644
--- a/rpc/api/admin_args.go
+++ b/rpc/api/admin_args.go
@@ -114,7 +114,7 @@ func (args *StartRPCArgs) UnmarshalJSON(b []byte) (err error) {
args.ListenPort = 8545
args.Apis = "net,eth,web3"
- if len(obj) >= 1 {
+ if len(obj) >= 1 && obj[0] != nil {
if addr, ok := obj[0].(string); ok {
args.ListenAddress = addr
} else {
@@ -122,7 +122,7 @@ func (args *StartRPCArgs) UnmarshalJSON(b []byte) (err error) {
}
}
- if len(obj) >= 2 {
+ if len(obj) >= 2 && obj[1] != nil {
if port, ok := obj[1].(float64); ok && port >= 0 && port <= 64*1024 {
args.ListenPort = uint(port)
} else {
@@ -130,7 +130,7 @@ func (args *StartRPCArgs) UnmarshalJSON(b []byte) (err error) {
}
}
- if len(obj) >= 3 {
+ if len(obj) >= 3 && obj[2] != nil {
if corsDomain, ok := obj[2].(string); ok {
args.CorsDomain = corsDomain
} else {
@@ -138,7 +138,7 @@ func (args *StartRPCArgs) UnmarshalJSON(b []byte) (err error) {
}
}
- if len(obj) >= 4 {
+ if len(obj) >= 4 && obj[3] != nil {
if apis, ok := obj[3].(string); ok {
args.Apis = apis
} else {
@@ -229,7 +229,7 @@ func (args *SetGlobalRegistrarArgs) UnmarshalJSON(b []byte) (err error) {
}
}
- if len(obj) >= 2 {
+ if len(obj) >= 2 && obj[1] != nil {
if addr, ok := obj[1].(string); ok {
args.ContractAddress = addr
} else {
@@ -251,7 +251,7 @@ func (args *SetHashRegArgs) UnmarshalJSON(b []byte) (err error) {
return shared.NewDecodeParamError(err.Error())
}
- if len(obj) >= 1 {
+ if len(obj) >= 1 && obj[0] != nil {
if hashreg, ok := obj[0].(string); ok {
args.HashReg = hashreg
} else {
@@ -259,7 +259,7 @@ func (args *SetHashRegArgs) UnmarshalJSON(b []byte) (err error) {
}
}
- if len(obj) >= 2 {
+ if len(obj) >= 2 && obj[1] != nil {
if sender, ok := obj[1].(string); ok {
args.Sender = sender
} else {
@@ -281,7 +281,7 @@ func (args *SetUrlHintArgs) UnmarshalJSON(b []byte) (err error) {
return shared.NewDecodeParamError(err.Error())
}
- if len(obj) >= 1 {
+ if len(obj) >= 1 && obj[0] != nil {
if urlhint, ok := obj[0].(string); ok {
args.UrlHint = urlhint
} else {
@@ -289,7 +289,7 @@ func (args *SetUrlHintArgs) UnmarshalJSON(b []byte) (err error) {
}
}
- if len(obj) >= 2 {
+ if len(obj) >= 2 && obj[1] != nil {
if sender, ok := obj[1].(string); ok {
args.Sender = sender
} else {
@@ -388,17 +388,19 @@ func (args *RegisterUrlArgs) UnmarshalJSON(b []byte) (err error) {
}
if len(obj) >= 1 {
- if sender, ok := obj[1].(string); ok {
+ if sender, ok := obj[0].(string); ok {
args.Sender = sender
} else {
return shared.NewInvalidTypeError("Sender", "not a string")
}
}
- if sender, ok := obj[1].(string); ok {
- args.ContentHash = sender
- } else {
- return shared.NewInvalidTypeError("ContentHash", "not a string")
+ if len(obj) >= 2 {
+ if sender, ok := obj[1].(string); ok {
+ args.ContentHash = sender
+ } else {
+ return shared.NewInvalidTypeError("ContentHash", "not a string")
+ }
}
if len(obj) >= 3 {
@@ -460,7 +462,7 @@ func (args *HttpGetArgs) UnmarshalJSON(b []byte) (err error) {
}
}
- if len(obj) >= 2 {
+ if len(obj) >= 2 && obj[1] != nil {
if path, ok := obj[1].(string); ok {
args.Path = path
} else {