From bfed9f24c2bdcbc4943150117ef81ab0996a1b79 Mon Sep 17 00:00:00 2001 From: Maksim Strebkov <257byte@gmail.com> Date: Sun, 30 Jul 2023 15:08:53 +0300 Subject: [PATCH] Check TransferTicket.TicketerId for null --- .../OperationRepository.TransferTicket.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Tzkt.Api/Repositories/OperationRepository.TransferTicket.cs b/Tzkt.Api/Repositories/OperationRepository.TransferTicket.cs index 51b25d52d..35ec97bc5 100644 --- a/Tzkt.Api/Repositories/OperationRepository.TransferTicket.cs +++ b/Tzkt.Api/Repositories/OperationRepository.TransferTicket.cs @@ -57,8 +57,8 @@ INNER JOIN ""Blocks"" as b StorageUsed = row.StorageUsed, BakerFee = row.BakerFee, StorageFee = row.StorageFee ?? 0, - Target = Accounts.GetAlias(row.TargetId), - Ticketer = Accounts.GetAlias(row.TicketerId), + Target = row.TargetId == null ? null : Accounts.GetAlias(row.TargetId) , + Ticketer = row.TicketerId == null ? null : Accounts.GetAlias(row.TicketerId), Amount = row.Amount, Entrypoint = row.Entrypoint, ContentType = (RawJson)Micheline.ToJson(row.RawType), @@ -104,8 +104,8 @@ INNER JOIN ""Blocks"" as b StorageUsed = row.StorageUsed, BakerFee = row.BakerFee, StorageFee = row.StorageFee ?? 0, - Target = Accounts.GetAlias(row.TargetId), - Ticketer = Accounts.GetAlias(row.TicketerId), + Target = row.TargetId == null ? null : Accounts.GetAlias(row.TargetId), + Ticketer = row.TicketerId == null ? null : Accounts.GetAlias(row.TicketerId), Amount = row.Amount, Entrypoint = row.Entrypoint, ContentType = (RawJson)Micheline.ToJson(row.RawType), @@ -149,8 +149,8 @@ SELECT o.* StorageUsed = row.StorageUsed, BakerFee = row.BakerFee, StorageFee = row.StorageFee ?? 0, - Target = Accounts.GetAlias(row.TargetId), - Ticketer = Accounts.GetAlias(row.TicketerId), + Target = row.TargetId == null ? null : Accounts.GetAlias(row.TargetId), + Ticketer = row.TicketerId == null ? null : Accounts.GetAlias(row.TicketerId), Amount = row.Amount, Entrypoint = row.Entrypoint, ContentType = (RawJson)Micheline.ToJson(row.RawType), @@ -225,8 +225,8 @@ INNER JOIN ""Blocks"" as b StorageUsed = row.StorageUsed, BakerFee = row.BakerFee, StorageFee = row.StorageFee ?? 0, - Target = Accounts.GetAlias(row.TargetId), - Ticketer = Accounts.GetAlias(row.TicketerId), + Target = row.TargetId == null ? null : Accounts.GetAlias(row.TargetId), + Ticketer = row.TicketerId == null ? null : Accounts.GetAlias(row.TicketerId), Amount = row.Amount, Entrypoint = row.Entrypoint, ContentType = (RawJson)Micheline.ToJson(row.RawType), @@ -392,11 +392,11 @@ public async Task GetTransferTicketOps( break; case "target": foreach (var row in rows) - result[j++][i] = await Accounts.GetAliasAsync(row.TargetId); + result[j++][i] = row.TargetId == null ? null : await Accounts.GetAliasAsync(row.TargetId); break; case "ticketer": foreach (var row in rows) - result[j++][i] = await Accounts.GetAliasAsync(row.TicketerId); + result[j++][i] = row.TicketerId == null ? null : await Accounts.GetAliasAsync(row.TicketerId); break; case "amount": foreach (var row in rows) @@ -586,11 +586,11 @@ public async Task GetTransferTicketOps( break; case "target": foreach (var row in rows) - result[j++] = await Accounts.GetAliasAsync(row.TargetId); + result[j++] = row.TargetId == null ? null : await Accounts.GetAliasAsync(row.TargetId); break; case "ticketer": foreach (var row in rows) - result[j++] = await Accounts.GetAliasAsync(row.TicketerId); + result[j++] = row.TicketerId == null ? null : await Accounts.GetAliasAsync(row.TicketerId); break; case "amount": foreach (var row in rows)