From f48dfee32d57f7d4a9703fb944c397efd9fe7c7a Mon Sep 17 00:00:00 2001 From: Vexatos Date: Sat, 10 Dec 2016 16:10:37 +0100 Subject: [PATCH] Fix #2173. --- src/main/scala/li/cil/oc/server/machine/Machine.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/scala/li/cil/oc/server/machine/Machine.scala b/src/main/scala/li/cil/oc/server/machine/Machine.scala index 78360eab5..7bc9fd0ed 100644 --- a/src/main/scala/li/cil/oc/server/machine/Machine.scala +++ b/src/main/scala/li/cil/oc/server/machine/Machine.scala @@ -765,7 +765,11 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach }) override def save(nbt: NBTTagCompound): Unit = Machine.this.synchronized(state.synchronized { - assert(!isExecuting) // Lock on 'this' should guarantee this. + // The lock on 'this' should guarantee that this never happens regularly. + // If something other than regular saving tries to save while we are executing code, + // e.g. SpongeForge saving during robot.move due to block changes being captured, + // just don't save this at all. What could possibly go wrong? + if(isExecuting) return if (SaveHandler.savingForClients) { return @@ -1076,4 +1080,4 @@ object Machine extends MachineAPI { } private val threadPool = ThreadPoolFactory.create("Computer", Settings.get.threads) -} \ No newline at end of file +}