Skip to content

Commit 5a5eed6

Browse files
authored
Merge pull request #114 from kaleido-io/fix_nil_pointer_inflight
fix null pointer when reading inflight queue
2 parents 15ae850 + 61540bd commit 5a5eed6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/txhandler/simple/policyloop.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Kaleido, Inc.
1+
// Copyright © 2024 Kaleido, Inc.
22
//
33
// SPDX-License-Identifier: Apache-2.0
44
//
@@ -206,7 +206,7 @@ func (sth *simpleTransactionHandler) processPolicyAPIRequests(ctx context.Contex
206206
var pending *pendingState
207207
// If this transaction is in-flight, we use that record
208208
for _, inflight := range sth.inflight {
209-
if inflight.mtx.ID == request.txID {
209+
if inflight != nil && inflight.mtx != nil && inflight.mtx.ID == request.txID {
210210
pending = inflight
211211
break
212212
}
@@ -483,7 +483,7 @@ func (sth *simpleTransactionHandler) HandleTransactionConfirmations(ctx context.
483483
// Will be picked up on the next policy loop cycle
484484
var pending *pendingState
485485
for _, p := range sth.inflight {
486-
if p.mtx.ID == txID {
486+
if p != nil && p.mtx != nil && p.mtx.ID == txID {
487487
pending = p
488488
break
489489
}
@@ -505,7 +505,7 @@ func (sth *simpleTransactionHandler) HandleTransactionConfirmations(ctx context.
505505
func (sth *simpleTransactionHandler) HandleTransactionReceiptReceived(ctx context.Context, txID string, receipt *ffcapi.TransactionReceiptResponse) (err error) {
506506
var pending *pendingState
507507
for _, p := range sth.inflight {
508-
if p.mtx.ID == txID {
508+
if p != nil && p.mtx != nil && p.mtx.ID == txID {
509509
pending = p
510510
break
511511
}

0 commit comments

Comments
 (0)