From 77c8069c05b310ed70c5046617f23cb98e5d1479 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Thu, 27 May 2021 15:59:57 -0700 Subject: [PATCH] colexecutils: make closure of nil spilling queue a no-op In some edge cases (shown by the follow-up commit) we might attempt to close a nil spilling queue. Previously, this would lead to a NPE (converted to an internal error). Now we make such operation a no-op. Release note: None (it is extremely unlikely that someone would run into this bug) --- pkg/sql/colexec/colexecutils/spilling_queue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sql/colexec/colexecutils/spilling_queue.go b/pkg/sql/colexec/colexecutils/spilling_queue.go index e255af67d72c..2f14072d06f7 100644 --- a/pkg/sql/colexec/colexecutils/spilling_queue.go +++ b/pkg/sql/colexec/colexecutils/spilling_queue.go @@ -513,7 +513,7 @@ func (q *SpillingQueue) MemoryUsage() int64 { // Close closes the spilling queue. func (q *SpillingQueue) Close(ctx context.Context) error { - if q.closed { + if q == nil || q.closed { return nil } if q.diskQueue != nil {