Check if name node is present before using it
This commit is contained in:
@@ -51,6 +51,9 @@ function checkNewMessages() {
|
|||||||
for (let messageNode of messageElements) {
|
for (let messageNode of messageElements) {
|
||||||
const el = messageNode.firstChild.firstChild.firstChild.firstChild;
|
const el = messageNode.firstChild.firstChild.firstChild.firstChild;
|
||||||
if (seenMessages.has(el)) continue;
|
if (seenMessages.has(el)) continue;
|
||||||
|
const rootNode = messageNode.parentNode.parentNode;
|
||||||
|
if (!rootNode.firstChild.firstChild) continue;
|
||||||
|
const name = rootNode.firstChild.firstChild.innerHTML;
|
||||||
newElements = true;
|
newElements = true;
|
||||||
seenMessages.add(el);
|
seenMessages.add(el);
|
||||||
let completionTime = Math.floor((Date.now() - startTime) / 1000);
|
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 awaiting times are available, use them first (i.e. the messages section just got opened).
|
||||||
if (awaitingTimes.length) completionTime = awaitingTimes.shift();
|
if (awaitingTimes.length) completionTime = awaitingTimes.shift();
|
||||||
|
|
||||||
const rootNode = messageNode.parentNode.parentNode;
|
|
||||||
const name = rootNode.firstChild.firstChild.innerHTML;
|
|
||||||
const dTime = displayTime(completionTime);
|
const dTime = displayTime(completionTime);
|
||||||
if (startTime > 0) {
|
if (startTime > 0) {
|
||||||
const text = el.innerHTML;
|
const text = el.innerHTML;
|
||||||
|
|||||||
Reference in New Issue
Block a user