From d3841b766f9d37d557646003899f67525c5f755f Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 5 Oct 2021 17:04:09 +0200 Subject: chore: add eslint-plugin-unicorn (#733) --- recipes/proton-mail/webview.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'recipes/proton-mail/webview.js') diff --git a/recipes/proton-mail/webview.js b/recipes/proton-mail/webview.js index ed66db5..395b779 100644 --- a/recipes/proton-mail/webview.js +++ b/recipes/proton-mail/webview.js @@ -4,10 +4,13 @@ module.exports = Ferdi => { if (!element) { return; } - const text = element.innerText; - const count = Ferdi.safeParseInt(text.substring(1, text.length - 1)); - Ferdi.setBadge(count); - } + const text = element.textContent; + if (text) { + // eslint-disable-next-line unicorn/prefer-string-slice + const count = Ferdi.safeParseInt(text.substring(1, text.length - 1)); + Ferdi.setBadge(count); + } + }; Ferdi.loop(getMessages); }; -- cgit v1.2.3-70-g09d2