From a3adac3787b5b52f64170d4e8925da18ffe70db9 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Mon, 9 Oct 2017 13:30:52 +0400 Subject: [PATCH] [rpc] do not try to parse params if they were not provided (Refs #708) --- rpc/lib/server/handlers.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rpc/lib/server/handlers.go b/rpc/lib/server/handlers.go index 9de6564dd..cb666b1e2 100644 --- a/rpc/lib/server/handlers.go +++ b/rpc/lib/server/handlers.go @@ -534,9 +534,13 @@ func (wsc *wsConnection) readRoutine() { var args []reflect.Value if rpcFunc.ws { wsCtx := types.WSRPCContext{Request: request, WSRPCConnection: wsc} - args, err = jsonParamsToArgsWS(rpcFunc, request.Params, wsCtx) + if request.Params != nil { + args, err = jsonParamsToArgsWS(rpcFunc, request.Params, wsCtx) + } } else { - args, err = jsonParamsToArgsRPC(rpcFunc, request.Params) + if request.Params != nil { + args, err = jsonParamsToArgsRPC(rpcFunc, request.Params) + } } if err != nil { wsc.WriteRPCResponse(types.RPCInternalError(request.ID, errors.Wrap(err, "Error converting json params to arguments")))