Skip to content

Commit

Permalink
FAB-302: fix panic for block-listener
Browse files Browse the repository at this point in the history
when receive a rejection event with no "-listen-to-rejections",
adapter of block-listener push a nil to notfy channel. This will
cause nil pointer panic. Fix the handle logic.

Change-Id: I8391af03acf32c6d99d613db6e2e7dc13d2424cc
Signed-off-by: jiangyaoguo <jiangyaoguo@gmail.com>
  • Loading branch information
jiangyaoguo committed Sep 11, 2016
1 parent 165c0ed commit 073ce43
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/events/block-listener/block-listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ func (a *adapter) Recv(msg *pb.Event) (bool, error) {
a.notfy <- o
return true, nil
}
if o, e := msg.Event.(*pb.Event_Rejection); e && a.listenToRejections {
a.rejected <- o
if o, e := msg.Event.(*pb.Event_Rejection); e {
if a.listenToRejections {
a.rejected <- o
}
return true, nil
}
if o, e := msg.Event.(*pb.Event_ChaincodeEvent); e {
a.cEvent <- o
return true, nil
}
a.notfy <- nil
return false, nil
return false, fmt.Errorf("Receive unkown type event: %v", msg)
}

//Disconnected implements consumer.EventAdapter interface for disconnecting
Expand Down

0 comments on commit 073ce43

Please sign in to comment.