From 7269e8440d6f21dc56b6e3268cd4c9da8aa2b4a1 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Thu, 12 Oct 2023 10:10:38 +0700 Subject: [PATCH] (easy FIX) --- .../chipmunk/chayapak/chomens_bot/song/SongLoaderThread.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/song/SongLoaderThread.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/song/SongLoaderThread.java index 70d26e1..a5231da 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/song/SongLoaderThread.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/song/SongLoaderThread.java @@ -88,7 +88,9 @@ public class SongLoaderThread extends Thread { try { if (isUrl) { bytes = DownloadUtilities.DownloadToByteArray(songUrl, 5 * 1024 * 1024); - name = Paths.get(songUrl.toURI().getPath()).getFileName().toString(); + final Path fileName = Paths.get(songUrl.toURI().getPath()).getFileName(); + + name = fileName == null ? "(root)" : fileName.toString(); } else { bytes = Files.readAllBytes(songPath); name = !isFolder ? fileName : songPath.getFileName().toString();