macOS: Fix a crash if no input event is set for a specific window

This commit is contained in:
Stuart Carnie
2025-05-14 06:57:56 +10:00
parent 209a446e36
commit 19dcd7162b

View File

@ -426,7 +426,10 @@ void DisplayServerEmbedded::_dispatch_input_events(const Ref<InputEvent> &p_even
void DisplayServerEmbedded::send_input_event(const Ref<InputEvent> &p_event, WindowID p_id) const {
if (p_id != INVALID_WINDOW_ID) {
_window_callback(input_event_callbacks[p_id], p_event);
const Callable *cb = input_event_callbacks.getptr(p_id);
if (cb) {
_window_callback(*cb, p_event);
}
} else {
for (const KeyValue<WindowID, Callable> &E : input_event_callbacks) {
_window_callback(E.value, p_event);