From 93f06e0f9d30d1259abdfce1f7f63e170a92ea30 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Thu, 7 Jan 2021 11:28:46 -0700 Subject: [PATCH] Fix rbf.Cursor.Close() panic --- rbf/cursor.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rbf/cursor.go b/rbf/cursor.go index 3920ffaec..5ffcaddf7 100644 --- a/rbf/cursor.go +++ b/rbf/cursor.go @@ -1388,7 +1388,10 @@ func (c *Cursor) difference(key uint64, data *roaring.Container) (bool, error) { func (c *Cursor) Close() { if c == nil { panic("cannot Close nil Cursor") + } else if c.tx == nil || c.tx.db == nil { + return // already closed } + tx := c.tx c.tx = nil // allow tx to be garbage collected.