fix(scheduled-jobs): handle null last_run_status in jobs list data endpoint

Jobs that have never run have last_run_status=NULL which caused a crash
when calling ->value and ->badgeVariant() on null. Use explicit null
checks instead of direct property access.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 22:21:42 +02:00
parent 2424f24d27
commit 49078f1853

View File

@@ -32,8 +32,8 @@ foreach ((array) ($result['rows'] ?? []) as $row) {
'schedule_summary' => $scheduledJobService->scheduleSummary($row),
'next_run_at' => dt((string) ($row['next_run_at'] ?? '')),
'last_run_finished_at' => dt((string) ($row['last_run_finished_at'] ?? '')),
'last_run_status' => $status->value ?? '',
'last_run_status_badge' => $status->badgeVariant(),
'last_run_status' => $status !== null ? $status->value : '',
'last_run_status_badge' => $status !== null ? $status->badgeVariant() : 'neutral',
'last_run_status_label' => $status !== null ? t($status->labelToken()) : '-',
'last_error' => trim((string) ($row['last_error_code'] ?? '')) !== ''
? trim((string) ($row['last_error_code'] ?? ''))