From aab67353d667fd6edcc9b09d7878fff4ddc79dc6 Mon Sep 17 00:00:00 2001 From: you Date: Fri, 20 Mar 2026 05:34:04 +0000 Subject: [PATCH] fix: null guard getElementById in animatePacket Elements don't exist yet when replayRecent fires during init. --- public/live.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/live.js b/public/live.js index a5112c5a..67add0e0 100644 --- a/public/live.js +++ b/public/live.js @@ -980,7 +980,7 @@ addNodeMarker(n); } }); - document.getElementById('liveNodeCount').textContent = Object.keys(nodeMarkers).length; + const _el2 = document.getElementById('liveNodeCount'); if (_el2) _el2.textContent = Object.keys(nodeMarkers).length; } catch (e) { console.error('Failed to load nodes:', e); } } @@ -1066,7 +1066,7 @@ function animatePacket(pkt) { packetCount++; pktTimestamps.push(Date.now()); - document.getElementById('livePktCount').textContent = packetCount; + const _el = document.getElementById('livePktCount'); if (_el) _el.textContent = packetCount; const decoded = pkt.decoded || {}; const header = decoded.header || {}; @@ -1086,7 +1086,7 @@ const n = { public_key: key, name: payload.name || key.slice(0,8), role: payload.role || 'unknown', lat: payload.lat, lon: payload.lon }; nodeData[key] = n; addNodeMarker(n); - document.getElementById('liveNodeCount').textContent = Object.keys(nodeMarkers).length; + const _el2 = document.getElementById('liveNodeCount'); if (_el2) _el2.textContent = Object.keys(nodeMarkers).length; } }