Skip to content

Commit

Permalink
[FAB-4616] Skip type switch on unmarshaling error
Browse files Browse the repository at this point in the history
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 <kostas@christidis.io>
  • Loading branch information
kchristidis committed Jun 13, 2017
1 parent 7253ae5 commit 9c4cb51
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions orderer/kafka/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ func (chain *chainImpl) processMessagesToBlocks() ([]uint64, error) {
// This shouldn't happen, it should be filtered at ingress
logger.Criticalf("[channel: %s] Unable to unmarshal consumed message = %s", chain.support.ChainID(), err)
counts[indexUnmarshalError]++
continue
} else {
logger.Debugf("[channel: %s] Successfully unmarshalled consumed message, offset is %d. Inspecting type...", chain.support.ChainID(), in.Offset)
counts[indexRecvPass]++
Expand Down

0 comments on commit 9c4cb51

Please sign in to comment.