From 26fe00f1e8fd6f7cc4802392301e95db8680ec1c Mon Sep 17 00:00:00 2001 From: NepDisk Date: Wed, 11 Feb 2026 12:42:20 -0500 Subject: [PATCH] Fix invalid items or itemamount from displaying SAD in the item slot --- src/k_hud.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/k_hud.c b/src/k_hud.c index 0e9e6bec3..eebbcb9a4 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1434,7 +1434,15 @@ static void K_drawKartItem(void) if (stplyr->itemamount <= 0 && stplyr->itemusecooldown <= 0) 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) localpatch = kp_nodraw; // diagnose underflows else if (K_IsKartItemAlternate(stplyr->itemtype) && K_ShowAltItemIcon(stplyr->itemtype, tiny))