Skip to content

Commit

Permalink
fix: Fix crash if xp cost ends up empty despite it initially claiming…
Browse files Browse the repository at this point in the history
… not to be empty
  • Loading branch information
BlayTheNinth committed Dec 14, 2023
1 parent 48b5e90 commit 26f0dec
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float
if (!xpCost.isEmpty()) {
boolean canAfford = xpCost.canAfford(mc.player);
final var xpCostAsLevels = xpCost.getCostAsLevels(mc.player);
final var spriteIndex = Math.min(xpCostAsLevels, 3) - 1;
final var spriteIndex = Math.max(0, Math.min(xpCostAsLevels, 3) - 1);
guiGraphics.blitSprite(canAfford ? ENABLED_LEVEL_SPRITES[spriteIndex] : DISABLED_LEVEL_SPRITES[spriteIndex], getX() + 2, getY() + 2, 16, 16);

if (xpCostAsLevels > 3) {
Expand Down

0 comments on commit 26f0dec

Please sign in to comment.