Fix server crash (NPE) when wireless connector ticks before AE2 grid nodes exist#641
Open
pbozic wants to merge 1 commit into
Open
Fix server crash (NPE) when wireless connector ticks before AE2 grid nodes exist#641pbozic wants to merge 1 commit into
pbozic wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WirelessConnect.updateStatus()passesgetNode()results directly intoGridHelper.createGridConnection()without a null check. AE2 creates gridnodes 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":
Once a world is in this state it crashes on every load, since the connector
ticks before AE2 finishes initializing.
Fix
createGridConnection; amissing node is treated as temporarily disconnected instead of crashing.
updateStatus()now returns whether it completed, andTileWirelessConnector.serverTick()keeps retrying each tick until bothnodes 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, sothe block state / power usage can't report a connection that failed to
initialize (previously it only checked the
shutdownflag).FailedConnectionExceptionnow 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.