From a1b178fb64b25ce527a3d17980a835741324df28 Mon Sep 17 00:00:00 2001 From: djoslin0 Date: Sat, 29 Nov 2025 04:15:46 -0800 Subject: [PATCH] Fix crash on input box (#1043) When typing ` into the coopnet password inputbox (the same as the console bind) It would do all of the null checks, then open the console changing the focus, then call a null function because the null checks are no longer valid. So I moved the null checks to where they're needed. Co-authored-by: MysterD --- src/pc/djui/djui_interactable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pc/djui/djui_interactable.c b/src/pc/djui/djui_interactable.c index cbb47a549..96f3acc06 100644 --- a/src/pc/djui/djui_interactable.c +++ b/src/pc/djui/djui_interactable.c @@ -279,10 +279,6 @@ bool djui_interactable_on_key_down(int scancode) { void djui_interactable_on_key_up(int scancode) { - bool keyFocused = (gInteractableFocus != NULL) - && (gInteractableFocus->interactable != NULL) - && (gInteractableFocus->interactable->on_key_up != NULL); - if (!gDjuiChatBoxFocus) { for (int i = 0; i < MAX_BINDS; i++) { if (scancode == (int)configKeyConsole[i]) { djui_console_toggle(); break; } @@ -304,6 +300,10 @@ void djui_interactable_on_key_up(int scancode) { } } + bool keyFocused = (gInteractableFocus != NULL) + && (gInteractableFocus->interactable != NULL) + && (gInteractableFocus->interactable->on_key_up != NULL); + if (keyFocused) { gInteractableFocus->interactable->on_key_up(gInteractableFocus, scancode); sKeyboardHoldDirection = PAD_HOLD_DIR_NONE;