From 833ccf76180585610cf79c721dc0d0ca1608a9bb Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 9 Sep 2024 14:04:30 +0900 Subject: [PATCH] fix: nil check for flushing Signed-off-by: hlts2 --- pkg/agent/core/ngt/service/ngt.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/agent/core/ngt/service/ngt.go b/pkg/agent/core/ngt/service/ngt.go index 9809e9d6b7..e96f4f5fd8 100644 --- a/pkg/agent/core/ngt/service/ngt.go +++ b/pkg/agent/core/ngt/service/ngt.go @@ -1941,15 +1941,24 @@ func (n *ngt) gc() { } func (n *ngt) Len() uint64 { - return n.kvs.Len() + if n != nil && n.kvs != nil { + return n.kvs.Len() + } + return 0 } func (n *ngt) InsertVQueueBufferLen() uint64 { - return uint64(n.vq.IVQLen()) + if n != nil && n.vq != nil { + return uint64(n.vq.IVQLen()) + } + return 0 } func (n *ngt) DeleteVQueueBufferLen() uint64 { - return uint64(n.vq.DVQLen()) + if n != nil && n.vq != nil { + return uint64(n.vq.DVQLen()) + } + return 0 } func (n *ngt) GetDimensionSize() int {