Skip to content

Fix crash in PanelSyncHandler and TextFieldHandler#133

Merged
brachy84 merged 2 commits into
masterfrom
fix/Fix-crash-in-PanelSyncHandler-and-TextFieldHandler
Jun 1, 2026
Merged

Fix crash in PanelSyncHandler and TextFieldHandler#133
brachy84 merged 2 commits into
masterfrom
fix/Fix-crash-in-PanelSyncHandler-and-TextFieldHandler

Conversation

@Luca-Guettinger

Copy link
Copy Markdown

Fix "IllegalStateException: Sync handler is not yet initialised!" in PanelSyncHandler.closePanelInternal() when closing a GUI during a mouse press event. The root cause is a timing issue: ModularNetwork.CLIENT.closeAll() disposes sync handlers immediately while PanelManager.dispose() is deferred by cantDisposeNow, so by the time deferred disposal finalizes panels, their sync handlers are already dead. The fix makes closePanelInternal skip sync operations when the sync infrastructure is already torn down.

Fix StringIndexOutOfBoundsException in TextFieldHandler.insert() when cursor.x exceeds the current line length, by clamping the cursor position to the line bounds before substring operations.

Tested on server

@brachy84 brachy84 enabled auto-merge (squash) June 1, 2026 08:34
@brachy84 brachy84 merged commit 966ed51 into master Jun 1, 2026
1 check passed
@brachy84 brachy84 deleted the fix/Fix-crash-in-PanelSyncHandler-and-TextFieldHandler branch June 1, 2026 08:36
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.

2 participants