Skip to content

Commit 428a762

Browse files
committed
Merge pull request #106367 from stuartcarnie/sgc_fix_embedded_crash
macOS: Fix a crash if no input event is set for a specific window
2 parents 8b4dd7a + 19dcd71 commit 428a762

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

platform/macos/display_server_embedded.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@
427427

428428
void DisplayServerEmbedded::send_input_event(const Ref<InputEvent> &p_event, WindowID p_id) const {
429429
if (p_id != INVALID_WINDOW_ID) {
430-
_window_callback(input_event_callbacks[p_id], p_event);
430+
const Callable *cb = input_event_callbacks.getptr(p_id);
431+
if (cb) {
432+
_window_callback(*cb, p_event);
433+
}
431434
} else {
432435
for (const KeyValue<WindowID, Callable> &E : input_event_callbacks) {
433436
_window_callback(E.value, p_event);

0 commit comments

Comments
 (0)