diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-03-13 10:34:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-13 10:34:31 +0100 |
commit | b1c9a7c757becd548eb9d40ef167269128d9abac (patch) | |
tree | cdb1b6138ba8662cf9a2e638bd1b080982cc84ab | |
parent | c446231a6eaa3389c4ce99e955b450b77374af8d (diff) | |
parent | 44cb8eb3a2c0aae7a4c5b1c41d72288b027a23fe (diff) |
Merge pull request #17410 from groud/fix_grid_container
Fixes infinite loop in GridContainer
-rw-r--r-- | scene/gui/grid_container.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp index 2799131f7f..9948672097 100644 --- a/scene/gui/grid_container.cpp +++ b/scene/gui/grid_container.cpp @@ -88,10 +88,10 @@ void GridContainer::_notification(int p_what) { remaining_space.width -= hsep * (max_col - 1); bool can_fit = false; - while (!can_fit) { + while (!can_fit && col_expanded.size() > 0) { // Check if all minwidth constraints are ok if we use the remaining space can_fit = true; - int max_index = 0; + int max_index = col_expanded.front()->get(); for (Set<int>::Element *E = col_expanded.front(); E; E = E->next()) { if (col_minw[E->get()] > col_minw[max_index]) { max_index = E->get(); @@ -109,10 +109,10 @@ void GridContainer::_notification(int p_what) { } can_fit = false; - while (!can_fit) { + while (!can_fit && row_expanded.size() > 0) { // Check if all minwidth constraints are ok if we use the remaining space can_fit = true; - int max_index = 0; + int max_index = row_expanded.front()->get(); for (Set<int>::Element *E = row_expanded.front(); E; E = E->next()) { if (row_minh[E->get()] > row_minh[max_index]) { max_index = E->get(); |