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