From e1998970e898dccdba59622c7326c7fd955b87a7 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Tue, 21 Sep 2021 07:39:12 -0700 Subject: [PATCH] Fix null album/artist navigation Adds a check before trying to navigate to album/artist page --- src/components/player/PlayerBar.tsx | 44 ++++++++++++++++++----------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/components/player/PlayerBar.tsx b/src/components/player/PlayerBar.tsx index 58955cf..2954cd5 100644 --- a/src/components/player/PlayerBar.tsx +++ b/src/components/player/PlayerBar.tsx @@ -406,15 +406,21 @@ const PlayerBar = () => { > - history.push( - `/library/album/${ - playQueue[currentEntryList][ - playQueue.currentIndex - ]?.albumId - }` - ) - } + onClick={() => { + if ( + playQueue[currentEntryList][ + playQueue.currentIndex + ]?.albumId + ) { + history.push( + `/library/album/${ + playQueue[currentEntryList][ + playQueue.currentIndex + ]?.albumId + }` + ); + } + }} > {playQueue[currentEntryList][playQueue.currentIndex] ?.title || 'Unknown title'} @@ -448,13 +454,19 @@ const PlayerBar = () => { tabIndex={0} subtitle="true" onClick={() => { - history.push( - `/library/artist/${ - playQueue[currentEntryList][ - playQueue.currentIndex - ]?.artistId - }` - ); + if ( + playQueue[currentEntryList][ + playQueue.currentIndex + ]?.artistId + ) { + history.push( + `/library/artist/${ + playQueue[currentEntryList][ + playQueue.currentIndex + ]?.artistId + }` + ); + } }} > {playQueue[currentEntryList][playQueue.currentIndex]