[#543] object/get: Fix potential NPE on request forwarder

Request forwarding callback should be called only if set since it is an
optional parameter. In GetRangeHash forwarder is never set.

Call `forwarder` function only if it is non-nil. Remove no longer needed
`hashOnly` option.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-20 11:04:20 +03:00 committed by Alex Vanin
parent 89b147ebe7
commit b2002ffc6d
3 changed files with 3 additions and 13 deletions

View file

@ -80,7 +80,7 @@ func (c *clientCacheWrapper) get(addr string) (getClient, error) {
}
func (c *clientWrapper) getObject(exec *execCtx) (*objectSDK.Object, error) {
if !exec.assembling && !exec.hashOnly() {
if !exec.assembling && exec.prm.forwarder != nil {
return exec.prm.forwarder(c.client)
}