Fixed crash when playlist directory is invalid

This commit is contained in:
notdraimdev
2024-09-17 19:05:48 +02:00
parent eaf729af1c
commit a941f0df49
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -106,8 +106,7 @@ func _ready() -> void:
print(data["Volume"])
SetVolume(data["Volume"])
if data.has("CurrIDX"):
CurrentIDX = int(data["CurrIDX"]) % textSongs.size()
print("awau" + str(int(data["CurrIDX"]) % textSongs.size()) )
CurrentIDX = int(data["CurrIDX"]) % textSongs.size() if textSongs.size() !=0 and int(data["CurrIDX"]) != 0 else 0
if data.has("Randomized"):
Randomize()
if data.has("Playing"):
@@ -172,7 +171,8 @@ func _ready() -> void:
print("Discord working: " + str(DiscordRPC.get_is_discord_working()))
# Set the first custom text row of the activity here
if textSongs.size() >= CurrentIDX:
DiscordRPC.details = textSongs[CurrentIDX]
if textSongs.size() > CurrentIDX:
DiscordRPC.details = textSongs[CurrentIDX]
# Set the second custom text row of the activity here
DiscordRPC.state = ""
# Image key for small image from "Art Assets" from the Discord Developer website