From c9578f48e0f7802de054a79585dc5cbbd9238d48 Mon Sep 17 00:00:00 2001 From: TopiSenpai Date: Sat, 29 Oct 2022 22:30:10 +0200 Subject: [PATCH] maybe fix null pointer --- main/build.gradle | 2 +- .../lavasrc/yandexmusic/YandexMusicAudioTrack.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main/build.gradle b/main/build.gradle index b0942031..aba1ca27 100644 --- a/main/build.gradle +++ b/main/build.gradle @@ -7,7 +7,7 @@ var moduleName = "lavasrc" dependencies { compileOnly "com.github.walkyst:lavaplayer-fork:1.3.98.4" - implementation 'org.jsoup:jsoup:1.14.3' + implementation "org.jsoup:jsoup:1.14.3" } publishing { diff --git a/main/src/main/java/com/github/topisenpai/lavasrc/yandexmusic/YandexMusicAudioTrack.java b/main/src/main/java/com/github/topisenpai/lavasrc/yandexmusic/YandexMusicAudioTrack.java index 987176e5..433ce6e6 100644 --- a/main/src/main/java/com/github/topisenpai/lavasrc/yandexmusic/YandexMusicAudioTrack.java +++ b/main/src/main/java/com/github/topisenpai/lavasrc/yandexmusic/YandexMusicAudioTrack.java @@ -1,6 +1,7 @@ package com.github.topisenpai.lavasrc.yandexmusic; import com.sedmelluq.discord.lavaplayer.container.mp3.Mp3AudioTrack; +import com.sedmelluq.discord.lavaplayer.source.AudioSourceManager; import com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream; import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; @@ -44,6 +45,11 @@ protected AudioTrack makeShallowClone() { return new YandexMusicAudioTrack(this.trackInfo, this.artworkURL, this.sourceManager); } + @Override + public AudioSourceManager getSourceManager() { + return this.sourceManager; + } + private String getDownloadURL(String id) throws IOException, NoSuchAlgorithmException { var json = this.sourceManager.getJson(YandexMusicSourceManager.PUBLIC_API_BASE + "/tracks/" + id + "/download-info"); if (json.isNull() || json.get("result").values().isEmpty()) {