From 4fe833164e27ddfb010ca62eb8939aac8ceaefbb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 22 Jun 2022 16:15:45 +0300 Subject: [PATCH] [#544] internal/neofs: Prevent potential NPE-panic in DeleteContainer Session token parameter of `NeoFS.DeleteContainer` method is optional and can be `nil`. Signed-off-by: Leonard Lyubich --- internal/neofs/neofs.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/neofs/neofs.go b/internal/neofs/neofs.go index 37ebb8e9..8c0aabb6 100644 --- a/internal/neofs/neofs.go +++ b/internal/neofs/neofs.go @@ -207,9 +207,12 @@ func (x *NeoFS) ContainerEACL(ctx context.Context, id cid.ID) (*eacl.Table, erro func (x *NeoFS) DeleteContainer(ctx context.Context, id cid.ID, token *session.Container) error { var prm pool.PrmContainerDelete prm.SetContainerID(id) - prm.SetSessionToken(*token) prm.SetWaitParams(x.await) + if token != nil { + prm.SetSessionToken(*token) + } + err := x.pool.DeleteContainer(ctx, prm) if err != nil { return fmt.Errorf("delete container via connection pool: %w", err)