Skip to content

Commit

Permalink
fix panic handler in NewCompressor (ledgerwatch#987)
Browse files Browse the repository at this point in the history
currently if newdecompressor panics, it will return nil, nil

this should make it return an error instead
  • Loading branch information
elee1766 authored and blxdyx committed Sep 13, 2023
1 parent 5c8ccb7 commit 3509c99
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compress/decompress.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,12 @@ func SetDecompressionTableCondensity(fromBitSize int) {
condensePatternTableBitThreshold = fromBitSize
}

func NewDecompressor(compressedFilePath string) (*Decompressor, error) {
func NewDecompressor(compressedFilePath string) (d *Decompressor, err error) {
_, fName := filepath.Split(compressedFilePath)
d := &Decompressor{
d = &Decompressor{
filePath: compressedFilePath,
fileName: fName,
}
var err error
defer func() {

if rec := recover(); rec != nil {
Expand Down

0 comments on commit 3509c99

Please sign in to comment.