Browse Source

Merge pull request #17340 from eska014/gridcontainer-divisionbyzero

Prevent division by zero in GridContainer
Rémi Verschelde 7 years ago
parent
commit
938469157f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scene/gui/grid_container.cpp

+ 2 - 2
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;