From a4694d4554fc92f231ba725dcaafb4b9515003e1 Mon Sep 17 00:00:00 2001 From: ProfMobius Date: Fri, 6 Dec 2013 23:51:46 +0100 Subject: [PATCH] Force create the canvas if needed to prevent a NPE. --- mcp/mobius/opis/overlay/OverlayLoadedChunks.java | 3 +++ mcp/mobius/opis/overlay/OverlayMeanTime.java | 3 +++ .../opis/overlay/entperchunk/OverlayEntityPerChunk.java | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/mcp/mobius/opis/overlay/OverlayLoadedChunks.java b/mcp/mobius/opis/overlay/OverlayLoadedChunks.java index e292260..71e7c7b 100644 --- a/mcp/mobius/opis/overlay/OverlayLoadedChunks.java +++ b/mcp/mobius/opis/overlay/OverlayLoadedChunks.java @@ -232,6 +232,9 @@ public class OverlayLoadedChunks implements IMwDataProvider { @SideOnly(Side.CLIENT) public void setupTable(HashSet tickets){ + if (this.canvas == null) + this.canvas = new LayoutCanvas(); + LayoutBase layout = (LayoutBase)this.canvas.addWidget("Table", new LayoutBase(null)); //layout.setGeometry(new WidgetGeometry(100.0,0.0,300.0,100.0,CType.RELXY, CType.REL_Y, WAlign.RIGHT, WAlign.TOP)); layout.setGeometry(new WidgetGeometry(100.0,0.0,30.0,100.0,CType.RELXY, CType.RELXY, WAlign.RIGHT, WAlign.TOP)); diff --git a/mcp/mobius/opis/overlay/OverlayMeanTime.java b/mcp/mobius/opis/overlay/OverlayMeanTime.java index f8f582e..1cdbbdb 100644 --- a/mcp/mobius/opis/overlay/OverlayMeanTime.java +++ b/mcp/mobius/opis/overlay/OverlayMeanTime.java @@ -258,6 +258,9 @@ public class OverlayMeanTime implements IMwDataProvider { @SideOnly(Side.CLIENT) public void setupTable(ArrayList entities){ + if (this.canvas == null) + this.canvas = new LayoutCanvas(); + LayoutBase layout = (LayoutBase)this.canvas.addWidget("Table", new LayoutBase(null)); //layout.setGeometry(new WidgetGeometry(100.0,0.0,300.0,100.0,CType.RELXY, CType.REL_Y, WAlign.RIGHT, WAlign.TOP)); layout.setGeometry(new WidgetGeometry(100.0,0.0,30.0,100.0,CType.RELXY, CType.RELXY, WAlign.RIGHT, WAlign.TOP)); diff --git a/mcp/mobius/opis/overlay/entperchunk/OverlayEntityPerChunk.java b/mcp/mobius/opis/overlay/entperchunk/OverlayEntityPerChunk.java index 2cff457..e445a1f 100644 --- a/mcp/mobius/opis/overlay/entperchunk/OverlayEntityPerChunk.java +++ b/mcp/mobius/opis/overlay/entperchunk/OverlayEntityPerChunk.java @@ -178,6 +178,9 @@ public class OverlayEntityPerChunk implements IMwDataProvider { @SideOnly(Side.CLIENT) public void setupChunkTable(){ + if (this.canvas == null) + this.canvas = new LayoutCanvas(); + if (this.canvas.hasWidget("Table")) this.canvas.delWidget("Table"); @@ -208,6 +211,9 @@ public class OverlayEntityPerChunk implements IMwDataProvider { @SideOnly(Side.CLIENT) public void setupEntTable(){ + if (this.canvas == null) + this.canvas = new LayoutCanvas(); + if (this.canvas.hasWidget("Table")) this.canvas.delWidget("Table");