fix buffer crash

This commit is contained in:
YouROK
2021-02-16 21:07:34 +03:00
parent cabc7c985d
commit 964a9568d9

View File

@@ -61,7 +61,7 @@ func (b *BufferPool) GetBuffer(p *Piece) (buff []byte, index int) {
}
func (b *BufferPool) ReleaseBuffer(index int) {
if index == -1 {
if index == -1 || b == nil {
return
}
b.mu.Lock()