From e3559fcc016f839e2d4b8b9b830ed339d4751a5f Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Thu, 1 Dec 2022 22:18:10 +0100 Subject: [PATCH] Make the extraction more tolerant to missing info --- src/renderer/components/playlist-info/playlist-info.js | 4 ++-- src/renderer/views/Playlist/Playlist.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/playlist-info/playlist-info.js b/src/renderer/components/playlist-info/playlist-info.js index 30f3e4da8d5e5..cbbcd86165e41 100644 --- a/src/renderer/components/playlist-info/playlist-info.js +++ b/src/renderer/components/playlist-info/playlist-info.js @@ -93,11 +93,11 @@ export default Vue.extend({ this.infoSource = this.data.infoSource // Causes errors if not put inside of a check - if (typeof (this.data.viewCount) !== 'undefined') { + if (typeof (this.data.viewCount) !== 'undefined' && !isNaN(this.data.viewCount)) { this.viewCount = this.hideViews ? null : Intl.NumberFormat(this.currentLocale).format(this.data.viewCount) } - if (typeof (this.data.videoCount) !== 'undefined') { + if (typeof (this.data.videoCount) !== 'undefined' && !isNaN(this.data.videoCount)) { this.videoCount = Intl.NumberFormat(this.currentLocale).format(this.data.videoCount) } diff --git a/src/renderer/views/Playlist/Playlist.js b/src/renderer/views/Playlist/Playlist.js index 1f41dd3311f4c..cb9400a9e94df 100644 --- a/src/renderer/views/Playlist/Playlist.js +++ b/src/renderer/views/Playlist/Playlist.js @@ -75,9 +75,9 @@ export default Vue.extend({ viewCount: extractNumberFromString(result.info.views), videoCount: extractNumberFromString(result.info.total_items), lastUpdated: result.info.last_updated ?? '', - channelName: result.info.author.name ?? '', - channelThumbnail: result.info.author.best_thumbnail?.url ?? '', - channelId: result.info.author.id, + channelName: result.info.author?.name ?? '', + channelThumbnail: result.info.author?.best_thumbnail?.url ?? '', + channelId: result.info.author?.id, infoSource: 'local' }