Skip to content

Commit

Permalink
Fix possible crash when invalid lap color
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiskster committed Oct 19, 2024
1 parent 2e6513b commit 8fc8968
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Lua/HUD/hud_lap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ local lap_hud = function(v, player)
cz.y = $ + shakey

if cz.y ~= nil and hudst.anim_active then
local color
local color = SKINCOLOR_PURPLE

if PTSR.LapColors[player.ptsr.laps] then
color = v.getColormap(nil, PTSR.LapColors[player.ptsr.laps])
else -- pseudo rng lap colors
local colornum = ((player.ptsr.laps*INT8_MAX)%#skincolors)+1
color = v.getColormap(nil, colornum)

if skincolors[colornum] then
color = v.getColormap(nil, colornum)
else
color = v.getColormap(nil, SKINCOLOR_PURPLE) -- default
end
end

v.drawScaled(cz.x, cz.y, FU/3, v.cachePatch"LAPFLAG", V_SNAPTOTOP, color)
Expand Down

0 comments on commit 8fc8968

Please sign in to comment.