fix nil panic error

msg is nil and if we continue executing, we'll get nil exception at
`msg.Msg.(....)`
This commit is contained in:
Anton Kaliaev 2018-05-22 15:42:37 +04:00
parent b9afcbe3a2
commit 118b86b1ef
No known key found for this signature in database
GPG Key ID: 7B6881D965918214
1 changed files with 4 additions and 2 deletions

View File

@ -144,8 +144,8 @@ type WALSearchOptions struct {
IgnoreDataCorruptionErrors bool
}
// SearchForEndHeight searches for the EndHeightMessage with the height and
// returns an auto.GroupReader, whenever it was found or not and an error.
// SearchForEndHeight searches for the EndHeightMessage with the given height
// and returns an auto.GroupReader, whenever it was found or not and an error.
// Group reader will be nil if found equals false.
//
// CONTRACT: caller must close group reader.
@ -170,7 +170,9 @@ func (wal *baseWAL) SearchForEndHeight(height int64, options *WALSearchOptions)
break
}
if options.IgnoreDataCorruptionErrors && IsDataCorruptionError(err) {
wal.Logger.Debug("Corrupted entry. Skipping...", "err", err)
// do nothing
continue
} else if err != nil {
gr.Close()
return nil, false, err