Merge pull request #17340 from eska014/gridcontainer-divisionbyzero

Prevent division by zero in GridContainer
This commit is contained in:
Rémi Verschelde 2018-03-08 08:35:00 +01:00 committed by GitHub
commit 938469157f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;