summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilherme Felipe <guilhermefelipecgs@gmail.com>2018-12-02 22:38:54 -0200
committerGuilherme Felipe <guilhermefelipecgs@gmail.com>2018-12-02 22:38:54 -0200
commit26c1af48481b32138bc34302432e4254bddcd529 (patch)
treeb8c9d29fe0c5d13b0ec3bb44deaf03ad316664e6
parent8dd00ed1762c4956b3231d709ce0d01ee9b306c8 (diff)
Add missing validations
Add missing validations to prevent crash of multiple mouse buttons being pressed
-rw-r--r--scene/main/viewport.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index fd584e82ad..3e27c86c67 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1747,7 +1747,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
mb->set_position(pos);
#ifdef DEBUG_ENABLED
- if (ScriptDebugger::get_singleton()) {
+ if (ScriptDebugger::get_singleton() && gui.mouse_focus) {
Array arr;
arr.push_back(gui.mouse_focus->get_path());
@@ -1850,7 +1850,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
gui.mouse_focus = NULL;
}
- if (mouse_focus->can_process()) {
+ if (mouse_focus && mouse_focus->can_process()) {
_gui_call_input(mouse_focus, mb);
}
@@ -2065,7 +2065,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
OS::get_singleton()->set_cursor_shape((OS::CursorShape)cursor_shape);
- if (over->can_process()) {
+ if (over && over->can_process()) {
_gui_call_input(over, mm);
}