From 513fed323a86f30996adc8e66f6cf6641b40e77a Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 4 Oct 2021 02:30:44 -0700 Subject: [PATCH] SkipListElementReference can be an empty object --- weed/util/skiplist/skiplist_serde.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/weed/util/skiplist/skiplist_serde.go b/weed/util/skiplist/skiplist_serde.go index 5b7089e80..e528b8a3d 100644 --- a/weed/util/skiplist/skiplist_serde.go +++ b/weed/util/skiplist/skiplist_serde.go @@ -34,8 +34,18 @@ func (t *SkipList) deleteElement(element *SkipListElement) error { } func (t *SkipList) loadElement(ref *SkipListElementReference) (*SkipListElement, error) { - if ref == nil { + if ref.IsNil() { return nil, nil } return t.listStore.LoadElement(ref.ElementPointer) } + +func (ref *SkipListElementReference) IsNil() bool { + if ref == nil { + return true + } + if len(ref.Key) == 0 { + return true + } + return false +} \ No newline at end of file