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 af85cb6 commit 7e5f152
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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 @@ -147,7 +151,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 7e5f152

Please sign in to comment.