From 6f755c6b68e6ec5b9fcc5db75a1ebfc4e7d9e077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Tue, 24 Jun 2014 17:35:54 +0200 Subject: [PATCH] Should fix #350. Bump version to RC1. --- build.properties | 2 +- .../cil/oc/common/component/TextBuffer.scala | 22 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/build.properties b/build.properties index c64fa7723..a52f4d901 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ minecraft.version=1.6.4 forge.version=9.11.1.964 oc.version=1.3.0 -oc.subversion=beta.1 +oc.subversion=rc.1 ccl.version=1.0.0.62 fmp.version=1.0.0.250 maven.url=file:///var/www/users/fnuecke/maven.cil.li \ No newline at end of file diff --git a/src/main/scala/li/cil/oc/common/component/TextBuffer.scala b/src/main/scala/li/cil/oc/common/component/TextBuffer.scala index ee57d313f..6a3736a43 100644 --- a/src/main/scala/li/cil/oc/common/component/TextBuffer.scala +++ b/src/main/scala/li/cil/oc/common/component/TextBuffer.scala @@ -531,43 +531,51 @@ object TextBuffer { } class ServerProxy(val owner: TextBuffer) extends Proxy { + // TODO This is a to prevent a NPE reported in #350. + // It is a workaround at best, as this is treating the symptons, and not + // the cause - which seems to be that the TickHandler used for adding nodes + // to the network may fail to run before the tile entities' update is + // performed -- even though it is marked to run at the start of the tick. + // I have no idea why that would be, however, so this has to do for now. + private def isValid = owner.node != null && owner.node.address != null + override def onScreenColorChange() { owner.owner.markChanged() - ServerPacketSender.sendTextBufferColorChange(owner.node.address, owner.data.foreground, owner.data.background, owner.owner) + if (isValid) ServerPacketSender.sendTextBufferColorChange(owner.node.address, owner.data.foreground, owner.data.background, owner.owner) } override def onScreenCopy(col: Int, row: Int, w: Int, h: Int, tx: Int, ty: Int) { super.onScreenCopy(col, row, w, h, tx, ty) owner.owner.markChanged() - ServerPacketSender.sendTextBufferCopy(owner.node.address, col, row, w, h, tx, ty, owner.owner) + if (isValid) ServerPacketSender.sendTextBufferCopy(owner.node.address, col, row, w, h, tx, ty, owner.owner) } override def onScreenDepthChange(depth: ColorDepth) { owner.owner.markChanged() - ServerPacketSender.sendTextBufferDepthChange(owner.node.address, depth, owner.owner) + if (isValid) ServerPacketSender.sendTextBufferDepthChange(owner.node.address, depth, owner.owner) } override def onScreenFill(col: Int, row: Int, w: Int, h: Int, c: Char) { super.onScreenFill(col, row, w, h, c) owner.owner.markChanged() - ServerPacketSender.sendTextBufferFill(owner.node.address, col, row, w, h, c, owner.owner) + if (isValid) ServerPacketSender.sendTextBufferFill(owner.node.address, col, row, w, h, c, owner.owner) } override def onScreenPaletteChange(index: Int) { owner.owner.markChanged() - ServerPacketSender.sendTextBufferPaletteChange(owner.node.address, index, owner.getPaletteColor(index), owner.owner) + if (isValid) ServerPacketSender.sendTextBufferPaletteChange(owner.node.address, index, owner.getPaletteColor(index), owner.owner) } override def onScreenResolutionChange(w: Int, h: Int) { super.onScreenResolutionChange(w, h) owner.owner.markChanged() - ServerPacketSender.sendTextBufferResolutionChange(owner.node.address, w, h, owner.owner) + if (isValid) ServerPacketSender.sendTextBufferResolutionChange(owner.node.address, w, h, owner.owner) } override def onScreenSet(col: Int, row: Int, s: String, vertical: Boolean) { super.onScreenSet(col, row, s, vertical) owner.owner.markChanged() - ServerPacketSender.sendTextBufferSet(owner.node.address, col, row, s, vertical, owner.owner) + if (isValid) ServerPacketSender.sendTextBufferSet(owner.node.address, col, row, s, vertical, owner.owner) } override def keyDown(character: Char, code: Int, player: EntityPlayer) {