Skip to content

Commit

Permalink
fix System.NullReferenceException in BaseActionHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
boscohyun committed Oct 29, 2024
1 parent 6ec46f0 commit f669876
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Mimir.Worker/ActionHandler/BaseActionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private async Task ProcessTransactions(
var txsResponse = await FetchTransactionsAsync(syncedBlockIndex, limit, cancellationToken);

var blockIndex = syncedBlockIndex + limit;
Logger.Information("GetTransaction Success, tx-count: {TxCount}", txsResponse.NCTransactions.Count);
Logger.Information("GetTransaction Success, tx-count: {TxCount}", txsResponse.NCTransactions?.Count ?? 0);
await HandleTransactionsAsync(
blockIndex,
txsResponse,
Expand Down Expand Up @@ -190,7 +190,7 @@ private async Task HandleTransactionsAsync(
TransactionResponse transactionResponse,
CancellationToken cancellationToken)
{
var tuples = transactionResponse.NCTransactions
var tuples = transactionResponse.NCTransactions?
.Where(tx => tx is not null)
.Select(tx =>
(
Expand All @@ -202,7 +202,7 @@ private async Task HandleTransactionsAsync(
.ToList()
)
)
.ToList();
.ToList() ?? [];

var documents = new List<WriteModel<BsonDocument>>();
foreach (var (txId, signer, actions) in tuples)
Expand Down
2 changes: 1 addition & 1 deletion Mimir.Worker/Client/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class GetTransactionsResponse
public class TransactionResponse
{
[JsonPropertyName("ncTransactions")]
public List<NcTransaction?> NCTransactions { get; set; }
public List<NcTransaction?>? NCTransactions { get; set; }
}

public class NcTransaction
Expand Down

0 comments on commit f669876

Please sign in to comment.