Prevented NPE in GuiReplayListEntry draw method

This commit is contained in:
CrushedPixel
2015-06-12 22:50:23 +02:00
parent 21be99f2a1
commit b1864424d9

View File

@@ -94,6 +94,7 @@ public class GuiReplayListEntry implements IGuiListEntry {
y + slotHeight - (mc.fontRendererObj.FONT_HEIGHT) * 2 - 2, Color.WHITE.getRGB()); y + slotHeight - (mc.fontRendererObj.FONT_HEIGHT) * 2 - 2, Color.WHITE.getRGB());
} }
if(fileInfo != null && fileInfo.getMetadata() != null) {
String duration = DurationUtils.convertSecondsToShortString(fileInfo.getMetadata().getDuration() / 1000); String duration = DurationUtils.convertSecondsToShortString(fileInfo.getMetadata().getDuration() / 1000);
int durationWidth = mc.fontRendererObj.getStringWidth(duration); int durationWidth = mc.fontRendererObj.getStringWidth(duration);
@@ -102,6 +103,7 @@ public class GuiReplayListEntry implements IGuiListEntry {
mc.fontRendererObj.drawStringWithShadow(duration, x + thumbnailOffset - 1 - durationWidth, mc.fontRendererObj.drawStringWithShadow(duration, x + thumbnailOffset - 1 - durationWidth,
y + slotHeight - mc.fontRendererObj.FONT_HEIGHT, Color.WHITE.getRGB()); y + slotHeight - mc.fontRendererObj.FONT_HEIGHT, Color.WHITE.getRGB());
}
String serverName = fileInfo.getMetadata().getServerName(); String serverName = fileInfo.getMetadata().getServerName();
if(serverName == null) serverName = ChatFormatting.DARK_RED.toString()+I18n.format("replaymod.gui.iphidden"); if(serverName == null) serverName = ChatFormatting.DARK_RED.toString()+I18n.format("replaymod.gui.iphidden");