fix: add null type guards to buildRows to prevent crashes on missing types
This commit is contained in:
@@ -24,6 +24,7 @@ export function buildRows(team: Team, from: string, to: string): CashboxExportRo
|
||||
const raw: RawRow[] = [];
|
||||
|
||||
for (const transaction of team.transactions ?? []) {
|
||||
if (!transaction.type) continue;
|
||||
raw.push({
|
||||
date: transaction.date,
|
||||
type: transaction.type.name,
|
||||
@@ -35,7 +36,7 @@ export function buildRows(team: Team, from: string, to: string): CashboxExportRo
|
||||
|
||||
for (const player of team.players ?? []) {
|
||||
for (const transaction of player.transactions ?? []) {
|
||||
if (transaction.type.name !== 'payment') continue;
|
||||
if (!transaction.type || transaction.type.name !== 'payment') continue;
|
||||
raw.push({
|
||||
date: transaction.date,
|
||||
type: transaction.type.name,
|
||||
|
||||
Reference in New Issue
Block a user