From da1d14d4583e9ede43e6571f73187ba6c37cb54b Mon Sep 17 00:00:00 2001 From: xRangerDE Date: Sun, 22 Mar 2026 15:23:21 +0100 Subject: [PATCH] fix: guard formatDuration against NaN/Infinity input Co-Authored-By: Claude Opus 4.6 (1M context) --- src/main.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.ts b/src/main.ts index 40ac937..9c7cd53 100644 --- a/src/main.ts +++ b/src/main.ts @@ -688,6 +688,7 @@ function parseDuration(duration: string): number { } function formatDuration(seconds: number): string { + if (!isFinite(seconds) || seconds < 0) return '00:00:00'; const h = Math.floor(seconds / 3600); const m = Math.floor((seconds % 3600) / 60); const s = Math.floor(seconds % 60); @@ -695,6 +696,7 @@ function formatDuration(seconds: number): string { } function formatDurationDashed(seconds: number): string { + if (!isFinite(seconds) || seconds < 0) return '00-00-00'; const h = Math.floor(seconds / 3600); const m = Math.floor((seconds % 3600) / 60); const s = Math.floor(seconds % 60);