Skip to content

Fix server crash (NPE) when wireless connector ticks before AE2 grid nodes exist#641

Open
pbozic wants to merge 1 commit into
GlodBlock:1.19.2-fabricfrom
pbozic:fix/wireless-connector-npe
Open

Fix server crash (NPE) when wireless connector ticks before AE2 grid nodes exist#641
pbozic wants to merge 1 commit into
GlodBlock:1.19.2-fabricfrom
pbozic:fix/wireless-connector-npe

Conversation

@pbozic

@pbozic pbozic commented Jul 23, 2026

Copy link
Copy Markdown

Problem

WirelessConnect.updateStatus() passes getNode() results directly into
GridHelper.createGridConnection() without a null check. AE2 creates grid
nodes lazily, so when a wireless connector pair ticks during world/chunk
load, one side's node may not exist yet. AE2 then throws an uncaught
NullPointerException and the server crashes with "Ticking block entity":

java.lang.NullPointerException: Ticking block entity
	at appeng.api.networking.GridHelper.createGridConnection(GridHelper.java:188)
	at com.glodblock.github.epp.common.me.WirelessConnect.updateStatus(WirelessConnect.java:104)
	at com.glodblock.github.epp.common.tiles.TileWirelessConnector.serverTick(TileWirelessConnector.java:41)

Once a world is in this state it crashes on every load, since the connector
ticks before AE2 finishes initializing.

Fix

  • Null-check both grid nodes before calling createGridConnection; a
    missing node is treated as temporarily disconnected instead of crashing.
  • updateStatus() now returns whether it completed, and
    TileWirelessConnector.serverTick() keeps retrying each tick until both
    nodes exist — so affected connectors self-heal once the grid is up,
    and previously broken worlds recover without removing the block.
  • isConnected() now also requires an actual established connection, so
    the block state / power usage can't report a connection that failed to
    initialize (previously it only checked the shutdown flag).
  • FailedConnectionException now marks the connector as shut down.

Tested on 1.19.2 fabric: a world that crashed on load with the above trace
now loads, and the connector pair reconnects automatically.

GridHelper.createGridConnection was called with the result of getNode()
without checking for null. AE2 creates grid nodes lazily, so a wireless
connector ticking during world/chunk load could pass a null node and
crash the server with "Ticking block entity" (NullPointerException at
GridHelper.createGridConnection).

- Null-check both grid nodes before creating the connection; treat a
  missing node as temporarily disconnected instead of crashing.
- Let updateStatus() report whether it completed, and keep retrying
  every tick until both AE2 nodes exist, so affected connectors
  self-heal once the grid finishes initializing.
- Harden isConnected() to require an actual established connection,
  and mark the connector shut down on FailedConnectionException.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant