From b9c51176adb977bf5d9f737392a14f2299f5e979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Mon, 30 Oct 2023 19:57:12 +0100 Subject: [PATCH] fix null error when apple music track has no artist (#136) --- .../lavasrc/applemusic/AppleMusicSourceManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/src/main/java/com/github/topi314/lavasrc/applemusic/AppleMusicSourceManager.java b/main/src/main/java/com/github/topi314/lavasrc/applemusic/AppleMusicSourceManager.java index 7740c04c..c4cb7db4 100644 --- a/main/src/main/java/com/github/topi314/lavasrc/applemusic/AppleMusicSourceManager.java +++ b/main/src/main/java/com/github/topi314/lavasrc/applemusic/AppleMusicSourceManager.java @@ -411,7 +411,12 @@ public AudioItem getSong(String id, String countryCode, boolean preview) throws private List parseTracks(JsonBrowser json, boolean preview, Map artistArtwork) { var tracks = new ArrayList(); for (var value : json.get("data").values()) { - tracks.add(this.parseTrack(value, preview, artistArtwork.get(this.parseArtistId(value)))); + var artistId = this.parseArtistId(value); + String artworkUrl = null; + if (artistId != null) { + artworkUrl = artistArtwork.get(artistId); + } + tracks.add(this.parseTrack(value, preview, artworkUrl)); } return tracks; }