From 6451f019d281011ba8a3699eac776310ec05ea90 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 18 Jan 2023 14:12:35 +0300 Subject: [PATCH] [#2203] shard: Do not panic in `Close` after unsuccessful `Init` Signed-off-by: Evgenii Stratonikov --- pkg/local_object_storage/shard/control.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/local_object_storage/shard/control.go b/pkg/local_object_storage/shard/control.go index 8cb465759..0a2506a1f 100644 --- a/pkg/local_object_storage/shard/control.go +++ b/pkg/local_object_storage/shard/control.go @@ -261,7 +261,10 @@ func (s *Shard) Close() error { } } - s.gc.stop() + // If Init/Open was unsuccessful gc can be nil. + if s.gc != nil { + s.gc.stop() + } return nil }