Skip to content

Commit

Permalink
Merge pull request #40 from sei-protocol/yzang/fix-nilpointer
Browse files Browse the repository at this point in the history
Fix nil interface conversion error
  • Loading branch information
yzang2019 authored Jan 3, 2024
2 parents 40541a7 + c6950fc commit 8da9717
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ func (c *lruCache) Remove(key []byte) Node {
}

func (c *lruCache) remove(e *list.Element) Node {
removed := c.ll.Remove(e).(Node)
delete(c.dict, ibytes.UnsafeBytesToStr(removed.GetCacheKey()))
return removed
element := c.ll.Remove(e)
if element != nil {
node := element.(Node)
delete(c.dict, ibytes.UnsafeBytesToStr(node.GetCacheKey()))
return node
}
return nil
}

0 comments on commit 8da9717

Please sign in to comment.