From b3eec11f00094fbb57ebfe862900c0ab03b26330 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Tue, 1 Nov 2016 18:32:58 +0000 Subject: [PATCH] Fixed a client crash with the Worldshaper's Astrolabe. Closes #2003 --- .../handler/ItemsRemainingRenderHandler.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/vazkii/botania/client/core/handler/ItemsRemainingRenderHandler.java b/src/main/java/vazkii/botania/client/core/handler/ItemsRemainingRenderHandler.java index bcb9e3418..ed8dd4a41 100644 --- a/src/main/java/vazkii/botania/client/core/handler/ItemsRemainingRenderHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/ItemsRemainingRenderHandler.java @@ -61,20 +61,22 @@ public final class ItemsRemainingRenderHandler { GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.enableBlend(); - String text; + String text = ""; if(customString == null) { - text = TextFormatting.GREEN + stack.getDisplayName(); - if(count >= 0) { - int max = stack.getMaxStackSize(); - int stacks = count / max; - int rem = count % max; + if(stack != null) { + text = TextFormatting.GREEN + stack.getDisplayName(); + if(count >= 0) { + int max = stack.getMaxStackSize(); + int stacks = count / max; + int rem = count % max; - if(stacks == 0) - text = "" + count; - else text = count + " (" + TextFormatting.AQUA + stacks + TextFormatting.RESET + "*" + TextFormatting.GRAY + max + TextFormatting.RESET + "+" + TextFormatting.YELLOW + rem + TextFormatting.RESET + ")"; - } else if(count == -1) - text = "\u221E"; + if(stacks == 0) + text = "" + count; + else text = count + " (" + TextFormatting.AQUA + stacks + TextFormatting.RESET + "*" + TextFormatting.GRAY + max + TextFormatting.RESET + "+" + TextFormatting.YELLOW + rem + TextFormatting.RESET + ")"; + } else if(count == -1) + text = "\u221E"; + } } else text = customString; int color = 0x00FFFFFF | (int) (alpha * 0xFF) << 24;