[#269] client: Fix response processing of `Object.Put` rpc

After 85e3c7b087 `processResponse` method
sets `err` field or sets status in `statusRes` field of `contextCall`.
In previous implementation `ObjectWriter.Close` method returned
`ctxCall.err` on `false` return of `processResponse` method. This could
cause NPE-panic if status failure resolving was disabled.

Make `ObjectWriter.Close` to return internal `err` field only if it is
set, otherwise return status response.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/fyrchik/update-contracts
Leonard Lyubich 2022-06-15 13:44:38 +03:00 committed by fyrchik
parent eb3b990812
commit ea21cdf731
1 changed files with 3 additions and 1 deletions

View File

@ -187,7 +187,9 @@ func (x *ObjectWriter) Close() (*ResObjectPut, error) {
return nil, x.ctxCall.err
}
if !x.ctxCall.processResponse() {
x.ctxCall.processResponse()
if x.ctxCall.err != nil {
return nil, x.ctxCall.err
}