summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorGilles Roudiere <gilles.roudiere@gmail.com>2018-03-10 14:01:20 +0100
committerGilles Roudiere <gilles.roudiere@gmail.com>2018-03-10 14:01:20 +0100
commit44cb8eb3a2c0aae7a4c5b1c41d72288b027a23fe (patch)
tree4bba1a1de4e584016550199e033fa9a2fefded89 /scene/gui
parentaeb1c67b5b55c769256a8ffc2f9d9095d6fc74da (diff)
Fixes infinite loop in GridContainer
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/grid_container.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index 9aac5137bc..82291382f7 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 = col_minw[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 = row_minh[E->get()];