From 8269e750200b7116613597397b697292a126bc14 Mon Sep 17 00:00:00 2001 From: sto Date: Sun, 9 Nov 2025 11:05:48 +0100 Subject: [PATCH] Check if name node is present before using it --- scripts/content.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/content.js b/scripts/content.js index c328eb9..8241128 100644 --- a/scripts/content.js +++ b/scripts/content.js @@ -51,6 +51,9 @@ function checkNewMessages() { for (let messageNode of messageElements) { const el = messageNode.firstChild.firstChild.firstChild.firstChild; if (seenMessages.has(el)) continue; + const rootNode = messageNode.parentNode.parentNode; + if (!rootNode.firstChild.firstChild) continue; + const name = rootNode.firstChild.firstChild.innerHTML; newElements = true; seenMessages.add(el); let completionTime = Math.floor((Date.now() - startTime) / 1000); @@ -58,8 +61,6 @@ function checkNewMessages() { // If awaiting times are available, use them first (i.e. the messages section just got opened). if (awaitingTimes.length) completionTime = awaitingTimes.shift(); - const rootNode = messageNode.parentNode.parentNode; - const name = rootNode.firstChild.firstChild.innerHTML; const dTime = displayTime(completionTime); if (startTime > 0) { const text = el.innerHTML;