Skip to content

Commit

Permalink
fix yandex music null tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Aug 28, 2023
1 parent 3f26e2e commit dec190c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ private AudioItem getAlbum(String id) throws IOException {
var tracks = new ArrayList<AudioTrack>();
for (var volume : json.get("result").get("volumes").values()) {
for (var track : volume.values()) {
tracks.add(this.parseTrack(track));
var parsedTrack = this.parseTrack(track);
if (parsedTrack != null) {
tracks.add(parsedTrack);
}
tracks.add(parsedTrack);
}
}
if (tracks.isEmpty()) {
Expand Down Expand Up @@ -150,7 +154,10 @@ private AudioItem getPlaylist(String userString, String id) throws IOException {
}
var tracks = new ArrayList<AudioTrack>();
for (var track : json.get("result").get("tracks").values()) {
tracks.add(this.parseTrack(track.get("track")));
var parsedTrack = this.parseTrack(track);
if (parsedTrack != null) {
tracks.add(parsedTrack);
}
}
if (tracks.isEmpty()) {
return AudioReference.NO_TRACK;
Expand Down

0 comments on commit dec190c

Please sign in to comment.