[#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

@ -38,7 +38,7 @@ type execCtx struct {
curOff uint64
head, hash bool
head bool
curProcEpoch uint64
@ -71,12 +71,6 @@ func withPayloadRange(r *objectSDK.Range) execOption {
}
}
func hashOnly() execOption {
return func(c *execCtx) {
c.hash = true
}
}
func (exec *execCtx) setLogger(l *logger.Logger) {
req := "GET"
if exec.headOnly() {
@ -152,10 +146,6 @@ func (exec *execCtx) headOnly() bool {
return exec.head
}
func (exec *execCtx) hashOnly() bool {
return exec.hash
}
func (exec *execCtx) netmapEpoch() uint64 {
return exec.prm.common.NetmapEpoch()
}