Skip to content

Commit

Permalink
FAB-2368 check for transaction action existence
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-2368

Got a panic from an unchecked access to transaction action
array.  This happened because the SDK client was out of sync on
protos, but still, this should be handled gracefully.

Change-Id: I8e2d1ed0fbd6ebba2baf11bc87dfaeb529fcc8f4
Signed-off-by: Srinivasan Muralidharan <[email protected]>
  • Loading branch information
Srinivasan Muralidharan committed Feb 19, 2017
1 parent 3c812af commit dd9f5ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions protos/utils/proputils.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ func GetActionFromEnvelope(envBytes []byte) (*peer.ChaincodeAction, error) {
return nil, err
}

if len(tx.Actions) == 0 {
return nil, fmt.Errorf("At least one TransactionAction is required")
}

_, respPayload, err := GetPayloads(tx.Actions[0])
return respPayload, err
}
Expand Down

0 comments on commit dd9f5ea

Please sign in to comment.