forked from TrueCloudLab/frostfs-node
[#543] object/search: Fix potential NPE on request forwarder
Request forwarding callback should be called only if set since it is an optional parameter. Call `forwarder` function only if it is non-nil. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
b2002ffc6d
commit
b587b23e79
1 changed files with 10 additions and 1 deletions
|
@ -76,9 +76,18 @@ func (c *clientConstructorWrapper) get(addr string) (searchClient, error) {
|
|||
}
|
||||
|
||||
func (c *clientWrapper) searchObjects(exec *execCtx) ([]*objectSDK.ID, error) {
|
||||
if exec.prm.forwarder != nil {
|
||||
return exec.prm.forwarder(c.client)
|
||||
}
|
||||
|
||||
return c.client.SearchObject(exec.context(),
|
||||
&exec.prm.SearchObjectParams,
|
||||
exec.prm.common.RemoteCallOptions(
|
||||
util.WithNetmapEpoch(exec.curProcEpoch),
|
||||
util.WithKey(exec.prm.common.PrivateKey()),
|
||||
)...)
|
||||
}
|
||||
|
||||
func (e *storageEngineWrapper) search(exec *execCtx) ([]*objectSDK.ID, error) {
|
||||
r, err := (*engine.StorageEngine)(e).Select(new(engine.SelectPrm).
|
||||
WithFilters(exec.searchFilters()).
|
||||
|
|
Loading…
Reference in a new issue