Skip to content

Commit 9c4cb51

Browse files
committed
[FAB-4616] Skip type switch on unmarshaling error
Even though that path (error in unmarshaling + type switch) was activated in the tests without issues, there is (might be? depends on the `proto` package) a non-zero chance we can end up with a non-nil error and a nil message. This will result in a nil panic dereference, come type-switch time. A `continue` statement prevents this from happening. Change-Id: Iff99519a81e6cfafd0d118fa8eefa9a15fc42649 Signed-off-by: Kostas Christidis <[email protected]>
1 parent 7253ae5 commit 9c4cb51

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

orderer/kafka/chain.go

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ func (chain *chainImpl) processMessagesToBlocks() ([]uint64, error) {
233233
// This shouldn't happen, it should be filtered at ingress
234234
logger.Criticalf("[channel: %s] Unable to unmarshal consumed message = %s", chain.support.ChainID(), err)
235235
counts[indexUnmarshalError]++
236+
continue
236237
} else {
237238
logger.Debugf("[channel: %s] Successfully unmarshalled consumed message, offset is %d. Inspecting type...", chain.support.ChainID(), in.Offset)
238239
counts[indexRecvPass]++

0 commit comments

Comments
 (0)