From 118b86b1ef78bd43d0a03dc663eac3b3516cc80c Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 22 May 2018 15:42:37 +0400 Subject: [PATCH] fix nil panic error msg is nil and if we continue executing, we'll get nil exception at `msg.Msg.(....)` --- consensus/wal.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/consensus/wal.go b/consensus/wal.go index 0ddc3138..7ae36eae 100644 --- a/consensus/wal.go +++ b/consensus/wal.go @@ -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