From a81f526cc66990664c7419a6a2c819347fc2ecf6 Mon Sep 17 00:00:00 2001 From: ryanfkeepers Date: Tue, 10 Oct 2023 10:57:41 -0600 Subject: [PATCH] don't set np chan to nil --- src/pkg/services/m365/api/item_pager.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pkg/services/m365/api/item_pager.go b/src/pkg/services/m365/api/item_pager.go index 6cd0c26eb..7e7eab537 100644 --- a/src/pkg/services/m365/api/item_pager.go +++ b/src/pkg/services/m365/api/item_pager.go @@ -83,9 +83,9 @@ func (npr *nextPageResults[T]) NextPage() ([]T, bool, bool) { return nil, false, true } - np := <-npr.pages + np, ok := <-npr.pages - return np.items, np.reset, false + return np.items, np.reset, !ok } func (npr *nextPageResults[T]) Results() (DeltaUpdate, error) { @@ -101,8 +101,9 @@ func (npr *nextPageResults[T]) Results() (DeltaUpdate, error) { } func (npr *nextPageResults[T]) close() { - close(npr.pages) - npr.pages = nil + if npr.pages != nil { + close(npr.pages) + } } // ---------------------------------------------------------------------------