fix: add null type guards to buildRows to prevent crashes on missing types

This commit is contained in:
Bastian Wagner
2026-08-03 21:02:52 +02:00
parent a9df62a249
commit cf7c3efb0f
2 changed files with 30 additions and 1 deletions

View File

@@ -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,