From 418f858807ca59d22cc5f812d022e122ff34a240 Mon Sep 17 00:00:00 2001 From: Adrian Victor Date: Sun, 19 Jul 2026 10:42:57 -0300 Subject: [PATCH] Check if message has unread badge before changing it. --- js/ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/ui.js b/js/ui.js index d2e1261..5ffe494 100644 --- a/js/ui.js +++ b/js/ui.js @@ -154,7 +154,7 @@ export const ui = { if (!msg.fromMe && (!activeChatState || activeChatState.id !== (msg.fromMe ? msg.to : msg.from))) { const unreadBadge = chat.querySelector('.unread-badge'); - unreadBadge.innerText = (Number(unreadBadge.innerHTML) || 0) + 1; + if (unreadBadge) unreadBadge.innerText = (Number(unreadBadge.innerHTML) || 0) + 1; } } },