diff --git a/apps/dashboard/src/components/vibe-coding/chat-adapters.ts b/apps/dashboard/src/components/vibe-coding/chat-adapters.ts index 464a46f7c..a98e8d662 100644 --- a/apps/dashboard/src/components/vibe-coding/chat-adapters.ts +++ b/apps/dashboard/src/components/vibe-coding/chat-adapters.ts @@ -98,7 +98,11 @@ export function applyDashboardPatches(source: string, edits: DashboardPatchEdit[ let chosenIndex: number; if (edit.occurrenceIndex != null) { - if (edit.occurrenceIndex < 0 || edit.occurrenceIndex >= matches.length) { + if ( + !Number.isInteger(edit.occurrenceIndex) + || edit.occurrenceIndex < 0 + || edit.occurrenceIndex >= matches.length + ) { failures.push({ index, reason: "not-found", oldTextPreview: preview }); return; }