Fix invalid items or itemamount from displaying SAD in the item slot

This commit is contained in:
NepDisk 2026-02-11 12:42:20 -05:00
parent e30774477f
commit 26fe00f1e8

View file

@ -1434,7 +1434,15 @@ static void K_drawKartItem(void)
if (stplyr->itemamount <= 0 && stplyr->itemusecooldown <= 0) if (stplyr->itemamount <= 0 && stplyr->itemusecooldown <= 0)
return; return;
localpatch = K_GetCachedItemPatch(stplyr->itemtype, tiny, stplyr->itemamount); if (stplyr->itemtype == 0 && stplyr->itemusecooldown <= 0)
return;
if (stplyr->itemtype >= numkartitems && stplyr->itemtype != MAXKARTITEMS)
return;
if (stplyr->itemtype > 0 && stplyr->itemamount > 0)
localpatch = K_GetCachedItemPatch(stplyr->itemtype, tiny, stplyr->itemamount);
if (localpatch == NULL) if (localpatch == NULL)
localpatch = kp_nodraw; // diagnose underflows localpatch = kp_nodraw; // diagnose underflows
else if (K_IsKartItemAlternate(stplyr->itemtype) && K_ShowAltItemIcon(stplyr->itemtype, tiny)) else if (K_IsKartItemAlternate(stplyr->itemtype) && K_ShowAltItemIcon(stplyr->itemtype, tiny))