diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-03-08 08:35:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 08:35:00 +0100 |
commit | 938469157fb6d513bab8b4b9e715761bb8376c1b (patch) | |
tree | 6a31204266ee77b9f2ea880315eada8656649c05 | |
parent | acacba3fdccceb1a627aff99c1e24384e52065ef (diff) | |
parent | 38623e07acb5addbd47b046d7734510d4e074156 (diff) |
Merge pull request #17340 from eska014/gridcontainer-divisionbyzero
Prevent division by zero in GridContainer
-rw-r--r-- | scene/gui/grid_container.cpp | 4 |
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; |