Skip to content

Commit dd9f5ea

Browse files
author
Srinivasan Muralidharan
committed
FAB-2368 check for transaction action existence
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]>
1 parent 3c812af commit dd9f5ea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

protos/utils/proputils.go

+4
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@ func GetActionFromEnvelope(envBytes []byte) (*peer.ChaincodeAction, error) {
469469
return nil, err
470470
}
471471

472+
if len(tx.Actions) == 0 {
473+
return nil, fmt.Errorf("At least one TransactionAction is required")
474+
}
475+
472476
_, respPayload, err := GetPayloads(tx.Actions[0])
473477
return respPayload, err
474478
}

0 commit comments

Comments
 (0)