Skip to content

Commit

Permalink
Fix: decoder parse panic recover
Browse files Browse the repository at this point in the history
  • Loading branch information
MakingL committed Mar 31, 2022
1 parent 85d470a commit 409e619
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions core/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ func (dec *Decoder) parse(cb func(object model.RedisObject) bool) error {

// Parse parses rdb and callback
// cb returns true to continue, returns false to stop the iteration
func (dec *Decoder) Parse(cb func(object model.RedisObject) bool) error {
var err error
func (dec *Decoder) Parse(cb func(object model.RedisObject) bool) (err error) {
defer func() {
if err2 := recover(); err2 != nil {
err = fmt.Errorf("panic: %v", err2)
Expand Down

0 comments on commit 409e619

Please sign in to comment.