From e2a319ae082941c7d0bfd406f4436cda0bb925e2 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Mon, 10 Aug 2026 04:30:54 -0400 Subject: [PATCH] Fix history.js null guard for speed and distance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formatSpeed and formatDistance return '—' on null/undefined values. Server trips may have null avg/max speed if no speed data was recorded. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- static/js/history.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/js/history.js b/static/js/history.js index 356b293..30aa38f 100644 --- a/static/js/history.js +++ b/static/js/history.js @@ -59,10 +59,12 @@ } function formatDistance(kilometers) { + if (kilometers == null) return '—'; return `${kilometers.toFixed(kilometers < 1 ? 2 : 1)} km`; } function formatSpeed(kilometersPerHour) { + if (kilometersPerHour == null) return '—'; return `${kilometersPerHour.toFixed(1)} km/h`; }