diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-04-02 09:46:51 +0200 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-04-02 09:46:51 +0200 |
commit | 1d3c9c448d805d0813a67efdd6677c312d72bb32 (patch) | |
tree | dbed32af33e87d1194d35c337887fb30865a9cc2 /scene/main | |
parent | 6731924dcfa7451d8b31461b438fd2a5aa8af1f6 (diff) |
Viewport: Fix undefined behaviour found by llvm sanitizer.
When godot was running as the project manager, it tried to call a method on a null pointer (get_tree()->get_edited_scene_root()).
This is undefined behaviour and caused a crash when compiled with sanitizing enabled.
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/viewport.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 23f8189167..3b8fd1ae3e 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1401,7 +1401,7 @@ void Viewport::_vp_input(const InputEvent &p_ev) { return; #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { + if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { return; } #endif @@ -1422,7 +1422,7 @@ void Viewport::_vp_unhandled_input(const InputEvent &p_ev) { if (disable_input) return; #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { + if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { return; } #endif |