fix edge case where songwheel would break if there is no song in index

This commit is contained in:
Kyle Humphrey 2022-03-23 17:52:06 -05:00
parent 90421885f5
commit cc73423b6a
1 changed files with 3 additions and 2 deletions

View File

@ -775,7 +775,6 @@ function drawScrollbar()
gfx.ImageRect(fillXPos, scrollbarYPos, sw, sh, scrollBarFillImage, 1, 0); gfx.ImageRect(fillXPos, scrollbarYPos, sw, sh, scrollBarFillImage, 1, 0);
-- 1st letter of song title on scroll -- 1st letter of song title on scroll
local letter = string.upper(common.firstLetter(songwheel.songs[selectedIndex].title));
gfx.BeginPath() gfx.BeginPath()
gfx.FontSize(16) gfx.FontSize(16)
gfx.LoadSkinFont('Digital-Serial-Bold.ttf') gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
@ -784,8 +783,10 @@ function drawScrollbar()
gfx.Fill() gfx.Fill()
gfx.FillColor(255,255,255) gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_MIDDLE + gfx.TEXT_ALIGN_CENTER) gfx.TextAlign(gfx.TEXT_ALIGN_MIDDLE + gfx.TEXT_ALIGN_CENTER)
if (songwheel.songs[selectedIndex] ~= nil) then
local letter = string.upper(common.firstLetter(songwheel.songs[selectedIndex].title));
gfx.Text(letter, fillXPos-10, scrollbarYPos + 5); gfx.Text(letter, fillXPos-10, scrollbarYPos + 5);
end
end end
function refreshIrLeaderboard(deltaTime) function refreshIrLeaderboard(deltaTime)