From a5ccaa919e897a4da8bc9e75ff82ad7676d0c605 Mon Sep 17 00:00:00 2001 From: Leon Krause Date: Wed, 7 Mar 2018 17:31:30 +0100 Subject: [PATCH] Prevent division by zero in GridContainer (cherry picked from commit 38623e07acb5addbd47b046d7734510d4e074156) --- scene/gui/grid_container.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp index b7c7c533dca..2799131f7f4 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;