Browse Source

SkipListElementReference can be an empty object

pull/2354/head
Chris Lu 3 years ago
parent
commit
513fed323a
  1. 12
      weed/util/skiplist/skiplist_serde.go

12
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) { func (t *SkipList) loadElement(ref *SkipListElementReference) (*SkipListElement, error) {
if ref == nil {
if ref.IsNil() {
return nil, nil return nil, nil
} }
return t.listStore.LoadElement(ref.ElementPointer) 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
}
Loading…
Cancel
Save