From 8d8ef672e7533ebee0d49109be40a04174a4c2a8 Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Wed, 13 Jul 2016 02:19:59 -0300 Subject: [PATCH] Fixed bug of app title related to badges Related to #91 --- app/util/Format.js | 2 +- electron/main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/util/Format.js b/app/util/Format.js index eef3b5b6..d9136332 100644 --- a/app/util/Format.js +++ b/app/util/Format.js @@ -9,6 +9,6 @@ Ext.define('Rambox.util.Format', { } ,stripNumber: function(n) { - return (typeof n == "number") ? n : parseInt(n.match(/\d+/g).join("")); + return (typeof n == "number") ? n : n.match(/\d+/g) ? parseInt(n.match(/\d+/g).join("")) : 0; } }); diff --git a/electron/main.js b/electron/main.js index 499946da..792f4ffd 100644 --- a/electron/main.js +++ b/electron/main.js @@ -163,7 +163,7 @@ function createWindow () { } function updateBadge(title) { - const messageCount = (/\(([0-9]+)\)/).exec(title); + var messageCount = title.match(/\d+/g) ? parseInt(title.match(/\d+/g).join("")) : 0; if (process.platform === 'win32') { tray.setBadge(messageCount);