/ song wheel crash when no songs are found

This commit is contained in:
FajsiEx 2021-08-12 11:52:37 +02:00
parent 0958417879
commit 2ff18307d1
1 changed files with 5 additions and 4 deletions

View File

@ -201,8 +201,7 @@ function drawBackground(deltaTime)
-- If the score for song exists -- If the score for song exists
local song = songwheel.songs[selectedIndex]; local song = songwheel.songs[selectedIndex];
local diff = song.difficulties[selectedDifficulty]; local diff = song and song.difficulties[selectedDifficulty] or false;
local bestScore = diff.scores[1];
if song and diff then if song and diff then
local jacketImage = getJacketImage(song); local jacketImage = getJacketImage(song);
gfx.BeginPath() gfx.BeginPath()
@ -334,8 +333,10 @@ end
local scoreNumbers = load_number_image("score_num"); local scoreNumbers = load_number_image("score_num");
function drawData() -- Draws the song data on the left panel function drawData() -- Draws the song data on the left panel
local song = songwheel.songs[selectedIndex]; local song = songwheel.songs[selectedIndex];
local diff = song.difficulties[selectedDifficulty]; local diff = song and song.difficulties[selectedDifficulty] or false;
local bestScore = diff.scores[1]; local bestScore = diff and diff.scores[1];
if not song then return false end
local jacketImage = getJacketImage(song); local jacketImage = getJacketImage(song);
gfx.BeginPath() gfx.BeginPath()