Skip to content

Commit

Permalink
Merge pull request #114 from kaleido-io/fix_nil_pointer_inflight
Browse files Browse the repository at this point in the history
fix null pointer when reading inflight queue
  • Loading branch information
Chengxuan authored Apr 10, 2024
2 parents 15ae850 + 61540bd commit 5a5eed6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/txhandler/simple/policyloop.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 Kaleido, Inc.
// Copyright © 2024 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -206,7 +206,7 @@ func (sth *simpleTransactionHandler) processPolicyAPIRequests(ctx context.Contex
var pending *pendingState
// If this transaction is in-flight, we use that record
for _, inflight := range sth.inflight {
if inflight.mtx.ID == request.txID {
if inflight != nil && inflight.mtx != nil && inflight.mtx.ID == request.txID {
pending = inflight
break
}
Expand Down Expand Up @@ -483,7 +483,7 @@ func (sth *simpleTransactionHandler) HandleTransactionConfirmations(ctx context.
// Will be picked up on the next policy loop cycle
var pending *pendingState
for _, p := range sth.inflight {
if p.mtx.ID == txID {
if p != nil && p.mtx != nil && p.mtx.ID == txID {
pending = p
break
}
Expand All @@ -505,7 +505,7 @@ func (sth *simpleTransactionHandler) HandleTransactionConfirmations(ctx context.
func (sth *simpleTransactionHandler) HandleTransactionReceiptReceived(ctx context.Context, txID string, receipt *ffcapi.TransactionReceiptResponse) (err error) {
var pending *pendingState
for _, p := range sth.inflight {
if p.mtx.ID == txID {
if p != nil && p.mtx != nil && p.mtx.ID == txID {
pending = p
break
}
Expand Down

0 comments on commit 5a5eed6

Please sign in to comment.