diff options
author | Ibrahn Sahir <ibrahn.sahir@gmail.com> | 2018-07-13 14:00:10 +0100 |
---|---|---|
committer | Ibrahn Sahir <ibrahn.sahir@gmail.com> | 2018-07-13 14:00:10 +0100 |
commit | fb32adfcf8baa38b8812204e540a557a90e1dcd5 (patch) | |
tree | 17cff69e2e4ca9bf6a6c68de0838bdf882290308 /scene/gui | |
parent | 1fc7973a00e17025441b6b8333e38d1606c1d304 (diff) |
fixed a branch on uninitialised data in gui/tree
I don't think it was really causing any harm, but this makes things a
little more explicit and helps clean up valgrind output.
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/tree.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 1d27612766..6ab1bf3d58 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2426,14 +2426,23 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { int col, h, section; TreeItem *it = _find_item_at_pos(root, mpos, col, h, section); - if ((drop_mode_flags && it != drop_mode_over) || section != drop_mode_section) { - drop_mode_over = it; - drop_mode_section = section; - update(); + if (drop_mode_flags) { + if (it != drop_mode_over) { + drop_mode_over = it; + update(); + } + if (it && section != drop_mode_section) { + drop_mode_section = section; + update(); + } } - if (it != cache.hover_item || col != cache.hover_cell) { + if (it != cache.hover_item) { cache.hover_item = it; + update(); + } + + if (it && col != cache.hover_cell) { cache.hover_cell = col; update(); } |