From 7afa4a2de4ba1174b5a4d32ae9ed42307df8d844 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sat, 14 Nov 2020 22:54:40 +1100 Subject: [PATCH] Fix panic in when bbolt storage has Closed --- storage/bolt_piece.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/storage/bolt_piece.go b/storage/bolt_piece.go index a932bea4..663ac35a 100644 --- a/storage/bolt_piece.go +++ b/storage/bolt_piece.go @@ -4,7 +4,6 @@ import ( "encoding/binary" "io" - "github.com/anacrolix/missinggo/x" "go.etcd.io/bbolt" "github.com/anacrolix/torrent/metainfo" @@ -32,7 +31,13 @@ func (me *boltDBPiece) pk() metainfo.PieceKey { func (me *boltDBPiece) Completion() Completion { c, err := me.pc().Get(me.pk()) - x.Pie(err) + switch err { + case bbolt.ErrDatabaseNotOpen: + return Completion{} + case nil: + default: + panic(err) + } return c } -- 2.48.1