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)