Merge pull request #4612 from bojidar-bg/fix-anchor-builds

Fix #4588 (crash in Control::_set_anchor)
This commit is contained in:
Rémi Verschelde
2016-05-11 17:46:29 +02:00
2 changed files with 5 additions and 4 deletions
+3 -4
View File
@@ -1287,14 +1287,13 @@ void Control::set_anchor(Margin p_margin,AnchorType p_anchor, bool p_keep_margin
void Control::_set_anchor(Margin p_margin,AnchorType p_anchor) {
#ifdef TOOLS_ENABLED
SceneTree *st=OS::get_singleton()->get_main_loop()->cast_to<SceneTree>();
if (st && st->is_editor_hint()) {
if (is_inside_tree() && get_tree()->is_editor_hint()) {
set_anchor(p_margin, p_anchor, EDITOR_DEF("2d_editor/keep_margins_when_changing_anchors", false));
} else {
set_anchor(p_margin, p_anchor);
set_anchor(p_margin, p_anchor, false);
}
#else
set_anchor(p_margin, p_anchor);
set_anchor(p_margin, p_anchor, false);
#endif
}