/ crashes when folder labels are not set on songselect & / low res jackets & + dynamic jackets

This commit is contained in:
FajsiEx 2021-08-13 22:36:21 +02:00
parent 73bfe6b41e
commit 3986d0d126
1 changed files with 7 additions and 3 deletions

View File

@ -189,7 +189,9 @@ end;
function getJacketImage(song) function getJacketImage(song)
if not jacketCache[song.id] or jacketCache[song.id]==defaultJacketImage then if not jacketCache[song.id] or jacketCache[song.id]==defaultJacketImage then
jacketCache[song.id] = gfx.LoadImageJob(song.difficulties[1].jacketPath, defaultJacketImage, 165, 165); jacketCache[song.id] = gfx.LoadImageJob(song.difficulties[
math.min(selectedDifficulty, #song.difficulties)
].jacketPath, defaultJacketImage, 500, 500);
end end
return jacketCache[song.id]; return jacketCache[song.id];
@ -453,10 +455,10 @@ function drawFilterInfo(deltatime)
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE) gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
gfx.BeginPath() gfx.BeginPath()
gfx.Text(folderLabel, 167, 131); gfx.Text(folderLabel or '', 167, 131);
gfx.BeginPath() gfx.BeginPath()
gfx.Text(subFolderLabel, 195, 166); gfx.Text(subFolderLabel or '', 195, 166);
end end
function drawSearch() function drawSearch()
@ -643,6 +645,8 @@ end;
set_diff = function(newDiff) set_diff = function(newDiff)
if newDiff ~= selectedDifficulty then if newDiff ~= selectedDifficulty then
jacketCache = {}; -- Clear the jacket cache for the new diff jackets
game.PlaySample('song_wheel/diff_change.wav'); game.PlaySample('song_wheel/diff_change.wav');
end end