diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index f960395f9..1c6565b95 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -539,7 +539,11 @@ func (s *Server) getApplicationLog(reqParams request.Params) (interface{}, *resp trig := trigger.All if len(reqParams) > 1 { - trig, err = trigger.FromString(reqParams.ValueWithType(1, request.StringT).String()) + trigString := reqParams.ValueWithType(1, request.StringT) + if trigString == nil { + return nil, response.ErrInvalidParams + } + trig, err = trigger.FromString(trigString.String()) if err != nil { return nil, response.ErrInvalidParams } diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index f1bf8384d..22c47b757 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -121,6 +121,11 @@ var rpcTestCases = map[string][]rpcTestCase{ assert.Equal(t, vm.HaltState, res.Executions[0].VMState) }, }, + { + name: "invalid trigger (not a string)", + params: `["` + genesisBlockHash + `", 1]`, + fail: true, + }, { name: "no params", params: `[]`,