From d6d59fc8de240ab7d5ad80deaff9d6a81b38a8d5 Mon Sep 17 00:00:00 2001 From: Lucas Duarte Sobreira Date: Tue, 21 Dec 2021 23:34:28 -0300 Subject: [PATCH 1/2] fix trying to notify using undefined data --- src/renderer/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/renderer/index.js b/src/renderer/index.js index 706a7777..acb9d957 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -343,11 +343,15 @@ const app = new Vue({ if (this.notification) { this.notification.close() } - this.notification = new Notification(a.name, { - body: a.artistName, - icon: (a.artwork.url.replace('/{w}x{h}bb', '/512x512bb')).replace('/2000x2000bb', '/35x35bb'), - silent: true - }) + if (a.artistName && a.artwork && a.name) { + this.notification = new Notification(a.name, { + body: a.artistName, + icon: a.artwork.url + .replace('/{w}x{h}bb', '/512x512bb') + .replace('/2000x2000bb', '/35x35bb'), + silent: true, + }); + } } }) From 574b4a61a4d5615f3576f650e2deac6def5fd09f Mon Sep 17 00:00:00 2001 From: Lucas Duarte Sobreira Date: Wed, 22 Dec 2021 09:39:58 -0300 Subject: [PATCH 2/2] move checks into platform check --- src/renderer/index.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/renderer/index.js b/src/renderer/index.js index acb9d957..e6b91fc2 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -339,19 +339,15 @@ const app = new Vue({ app.loadLyrics() // Playback Notifications - if ((app.platform === "darwin" || app.platform === "linux") && !document.hasFocus()) { + if ((app.platform === "darwin" || app.platform === "linux") && !document.hasFocus() && a.artistName && a.artwork && a.name) { if (this.notification) { this.notification.close() } - if (a.artistName && a.artwork && a.name) { - this.notification = new Notification(a.name, { - body: a.artistName, - icon: a.artwork.url - .replace('/{w}x{h}bb', '/512x512bb') - .replace('/2000x2000bb', '/35x35bb'), - silent: true, - }); - } + this.notification = new Notification(a.name, { + body: a.artistName, + icon: a.artwork.url.replace('/{w}x{h}bb', '/512x512bb').replace('/2000x2000bb', '/35x35bb'), + silent: true, + }); } })