From ea21cdf731e8bebedd4128a4366db3be8624d66a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 15 Jun 2022 13:44:38 +0300 Subject: [PATCH] [#269] client: Fix response processing of `Object.Put` rpc After 85e3c7b0870693fe025c5c46cabfb583d2bb5811 `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 --- client/object_put.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/object_put.go b/client/object_put.go index 318e1d0c..b00cee8a 100644 --- a/client/object_put.go +++ b/client/object_put.go @@ -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 }