From 5f332f7a88a0be3724775f96e8934bce8cd26f3e Mon Sep 17 00:00:00 2001 From: RemixDev Date: Mon, 7 Jun 2021 14:20:48 +0200 Subject: [PATCH] Added check for empty single albums Thanks digitalec --- deemix/itemgen.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deemix/itemgen.js b/deemix/itemgen.js index 79fdb1e..0067b0d 100644 --- a/deemix/itemgen.js +++ b/deemix/itemgen.js @@ -78,7 +78,11 @@ async function generateAlbumItem(dz, id, bitrate, rootArtist){ // If the album is a single download as a track if (albumAPI.nb_tracks == 1){ - return generateTrackItem(dz, albumAPI.tracks.data[0].id, bitrate, null, albumAPI) + if (albumAPI.tracks.data.length){ + return generateTrackItem(dz, albumAPI.tracks.data[0].id, bitrate, null, albumAPI) + } else { + throw new GenerationError(`https://deezer.com/album/${id}`, "Single has no tracks.") + } } let tracksArray = await dz.gw.get_album_tracks(id)