summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorLeon Krause <lk@leonkrause.com>2018-03-07 17:31:30 +0100
committerLeon Krause <lk@leonkrause.com>2018-03-07 17:36:28 +0100
commit38623e07acb5addbd47b046d7734510d4e074156 (patch)
tree7532aec936815aa2b541fdeaec91cca2014f1814 /scene/gui
parent2f3c45f55eab7364ff0f6806c81ddc7ba861e1a2 (diff)
Prevent division by zero in GridContainer
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/grid_container.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index c2b8a7dfab..9aac5137bc 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -130,8 +130,8 @@ void GridContainer::_notification(int p_what) {
}
// Finally, fit the nodes
- int col_expand = remaining_space.width / col_expanded.size();
- int row_expand = remaining_space.height / row_expanded.size();
+ int col_expand = col_expanded.size() > 0 ? remaining_space.width / col_expanded.size() : 0;
+ int row_expand = row_expanded.size() > 0 ? remaining_space.height / row_expanded.size() : 0;
int col_ofs = 0;
int row_ofs = 0;