rpc: fix unmarshaling of null result in CallContext (#26723)

The change fixes unmarshaling of JSON null results into json.RawMessage.

---------

Co-authored-by: Jason Yuan <jason.yuan@curvegrid.com>
Co-authored-by: Jason Yuan <jason.yuan869@gmail.com>
This commit is contained in:
Felix Lange
2023-02-19 14:23:18 -05:00
committed by GitHub
co-authored by Jason Yuan Jason Yuan
parent 7c749c947a
commit 1db978ca6b
4 changed files with 29 additions and 2 deletions
+4 -1
View File
@@ -345,7 +345,10 @@ func (c *Client) CallContext(ctx context.Context, result interface{}, method str
case len(resp.Result) == 0:
return ErrNoResult
default:
return json.Unmarshal(resp.Result, &result)
if result == nil {
return nil
}
return json.Unmarshal(resp.Result, result)
}
}