Skip to content

Commit

Permalink
Fix error when song list is empty
Browse files Browse the repository at this point in the history
If there are no songs in the regular song list, and the user mounts up
on a mount that has no custom songs defined for it, an error will be
thrown as we try to take a random song from an empty list.

To fix it we just add a check for if the list is empty.

Fixes #6
  • Loading branch information
Sharparam committed Sep 2, 2024
1 parent 909ca91 commit b9e67b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Chocobo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ end
function C:PlayRandomMusic(mount)
if mount then
self:PlayMusic(mount, true)
else
elseif #self.Global["MUSIC"] > 0 then
local id = math.random(1, #self.Global["MUSIC"])
if self.Global["PREVENTDUPE"] and #self.Global["MUSIC"] > 1 then
local name = self.Global["MUSIC"][id]
Expand Down

0 comments on commit b9e67b6

Please sign in to comment.