Skip to content

Added null check and removal from open queue to closing windows on the client side#92

Merged
RecursivePineapple merged 3 commits intoGTNewHorizons:masterfrom
TheYoingLad:tryClose
Oct 9, 2025
Merged

Added null check and removal from open queue to closing windows on the client side#92
RecursivePineapple merged 3 commits intoGTNewHorizons:masterfrom
TheYoingLad:tryClose

Conversation

@TheYoingLad
Copy link
Contributor

@TheYoingLad TheYoingLad commented Oct 9, 2025

Issue

Prior to this fix when a request to open and close (in this order) the same window arrived on the same tick from the server, the client had no time to actually open the window and so a null exception occured here (window would be null):

} else if (id == DataCodes.CLOSE_WINDOW) {
window.tryClose();
}

Example

This could be seen in the case of the gt5 Drone Centre, where on the machine list window, losing focus of the textbox and clicking the sort and localise buttons had this effect:

getContext().closeWindow(MACHINE_LIST_WINDOW_ID);
getContext().openSyncedWindow(MACHINE_LIST_WINDOW_ID);

This means the client recieved the request close-open, which is not problematic.

However, when one of the affore mentioned buttons get clicked whilst the textbox is still active the following request is sent to the client: close-open-close-open. We can see that the problematic request has appeared.

On the client side during the execution of the second close request, the window that is requested to be closed has not been opened yet, it is still in the queuedOpenWindow list. This list gets emptied (ie the window gets opened) on a new client tick, which in most cases happens later than the atttempt to close it.

Solution

First, check to see if the window to be closed is open or not (window == null). Second, if it's not, meaning it is probably in the list of queued windows to be opened, just remove it from that list.

Fixes GTNewHorizons/GT-New-Horizons-Modpack/issues/16580
Probably also fixes GTNewHorizons/GT-New-Horizons-Modpack/issues/19771, the error message and the circumstances are similar

@Dream-Master Dream-Master requested a review from a team October 9, 2025 08:01
@RecursivePineapple RecursivePineapple merged commit 0c9dd57 into GTNewHorizons:master Oct 9, 2025
1 check passed
@TheYoingLad TheYoingLad deleted the tryClose branch October 9, 2025 19:13
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.

Electrolyzer GUI causes null pointer exception Drone center kicked from the world with an error

2 participants

Comments