diff --git a/src/main/scala/li/cil/oc/server/network/Node.scala b/src/main/scala/li/cil/oc/server/network/Node.scala index 9aa34ea99..ec598dbf3 100644 --- a/src/main/scala/li/cil/oc/server/network/Node.scala +++ b/src/main/scala/li/cil/oc/server/network/Node.scala @@ -36,7 +36,12 @@ trait Node extends ImmutableNode { if (network == null) Iterable.empty[ImmutableNode].toSeq else network.neighbors(this) - def connect(node: ImmutableNode) = network.connect(this, node) + // a node should be added to a network before it can connect to a node + // but, sometimes other mods try to create nodes and connect them before + // the network is ready. we dont those things to crash here + // with typical nodes we are talking about components here + // which will be connected anyways when the network is created + def connect(node: ImmutableNode): Unit = if (network != null) network.connect(this, node) def disconnect(node: ImmutableNode) = if (network != null && isInSameNetwork(node)) network.disconnect(this, node)