Skip to content

Commit 2273c10

Browse files
committed
Fix out of control area mouse events crash, if nothing have mouse focus.
1 parent 825ef23 commit 2273c10

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

scene/main/viewport.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,10 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
19031903
}
19041904
MouseButtonMask button_mask = mouse_button_to_mask(mb->get_button_index());
19051905
if (!gui.mouse_focus_mask.is_empty() && !gui.mouse_focus_mask.has_flag(button_mask)) {
1906+
if (!gui.mouse_focus) {
1907+
return;
1908+
}
1909+
19061910
// Do not steal mouse focus and stuff while a focus mask without the current mouse button exists.
19071911
gui.mouse_focus_mask.set_flag(button_mask);
19081912
} else {

0 commit comments

Comments
 (0)