From 893152d8f5bd63255cb7132bddbcca7f920b03a0 Mon Sep 17 00:00:00 2001 From: Michael Heuberger Date: Tue, 18 Aug 2026 20:09:33 +1200 Subject: [PATCH] Fix: Handle edge case where intervalSum is zero during quick recordings - Replace truthy/falsy check with explicit validation in getAvgInterval() - Replace truthy/falsy check with explicit validation in getAvgFps() - Issue: JavaScript treats 0 as falsy, causing avgFps to become undefined - Impact: Prevents 'Average FPS cannot be undefined' error on poster generation - Root cause: Very quick recordings may have intervalSum = 0, triggering falsy check The fix ensures avgFps calculation works correctly for all recording durations, even extremely brief recordings where elapsed time is 0. --- src/wrappers/visuals/recorder.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wrappers/visuals/recorder.ts b/src/wrappers/visuals/recorder.ts index 59700061..2893782d 100644 --- a/src/wrappers/visuals/recorder.ts +++ b/src/wrappers/visuals/recorder.ts @@ -968,7 +968,8 @@ class Recorder extends Despot { private getAvgInterval() { const intervalSum = this.getIntervalSum(); - if (!intervalSum) { + // Explicitly reject undefined and invalid values (zero or negative). + if (intervalSum === undefined || intervalSum <= 0) { return undefined; } @@ -978,7 +979,8 @@ class Recorder extends Despot { private getAvgFps() { const intervalSum = this.getIntervalSum(); - if (!intervalSum) { + // Explicitly reject undefined and invalid values (zero or negative). + if (intervalSum === undefined || intervalSum <= 0) { return undefined; }