From bd08d91fc1aa52c72a7efefff7923d282293454d Mon Sep 17 00:00:00 2001 From: you Date: Sun, 22 Mar 2026 05:08:06 +0000 Subject: [PATCH] fix: null-guard all animation entry points (pulseNode, animatePath, drawAnimatedLine) All animation functions now bail early if animLayer/pathsLayer are null, preventing cascading errors from setInterval callbacks after navigation. --- public/index.html | 2 +- public/live.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index d9ca91f7..f8fd9753 100644 --- a/public/index.html +++ b/public/index.html @@ -90,7 +90,7 @@ - + diff --git a/public/live.js b/public/live.js index f291c547..7139e8c4 100644 --- a/public/live.js +++ b/public/live.js @@ -1555,6 +1555,7 @@ } function animatePath(hopPositions, typeName, color) { + if (!animLayer || !pathsLayer) return; activeAnims++; document.getElementById('liveAnimCount').textContent = activeAnims; let hopIndex = 0; @@ -1600,6 +1601,7 @@ } function pulseNode(key, pos, typeName) { + if (!animLayer || !nodesLayer) return; if (!nodeMarkers[key]) { const ghost = L.circleMarker(pos, { radius: 5, fillColor: '#6b7280', fillOpacity: 0.3, color: '#fff', weight: 0.5, opacity: 0.2 @@ -1653,6 +1655,7 @@ } function drawAnimatedLine(from, to, color, onComplete, overrideOpacity) { + if (!animLayer || !pathsLayer) { if (onComplete) onComplete(); return; } const steps = 20; const latStep = (to[0] - from[0]) / steps; const lonStep = (to[1] - from[1]) / steps;