Safely handling non-result responses from Genius (for lyrics)

This commit is contained in:
James Barnsley
2023-01-25 20:50:21 +13:00
parent a5935bce41
commit 0b03177b7f
2 changed files with 4 additions and 2 deletions

View File

@ -258,7 +258,9 @@ export function findTrackLyrics(uri) {
// Immediately go and get the first result's lyrics
const lyrics_result = lyrics_results[0];
dispatch(getTrackLyrics(track.uri, lyrics_result.path));
if (lyrics_result) {
dispatch(getTrackLyrics(track.uri, lyrics_result.path));
}
}
dispatch(uiActions.stopLoading(loader_key));
},

View File

@ -106,7 +106,7 @@ const KioskMode = () => {
if (current_track.lyrics) return;
// We got results, but failed to load the lyrics, so re-try
if (current_track.lyrics_results && current_track.lyrics === null) {
if (current_track?.lyrics_results && current_track.lyrics === null) {
dispatch(geniusActions.getTrackLyrics(current_track.uri, current_track.path));
return;
}