fix(cron): guard hasInlineState against null/undefined job entries

Legacy jobs arrays may contain null items. hasInlineState now skips
them instead of throwing, preserving prior fault-tolerant behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Feelw00
2026-04-09 09:08:04 +09:00
committed by Gustavo Madeira Santana
parent 074fabc540
commit a1a08e27db

View File

@@ -86,9 +86,10 @@ async function loadStateFile(statePath: string): Promise<CronStateFile | null> {
}
}
function hasInlineState(jobs: Array<Record<string, unknown>>): boolean {
function hasInlineState(jobs: Array<Record<string, unknown> | null | undefined>): boolean {
return jobs.some(
(job) =>
job != null &&
job.state !== undefined &&
typeof job.state === "object" &&
job.state !== null &&