summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorGilles Roudière <gilles.roudiere@gmail.com>2021-06-29 11:26:56 +0200
committerGilles Roudière <gilles.roudiere@gmail.com>2021-06-29 11:27:09 +0200
commitc5b65236d8b6cf463abb98bc19eeea4f6ec4098e (patch)
tree9fed2cc6776f809dcd4a4d240ceea2679a969752 /scene
parenteb318d3e04ac6d3bb01b0f2a8311d06ba55c3a2b (diff)
Fixes crash in case no column in tree is expanded and has minimum size
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/tree.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 521d37060a..aac15cd9a5 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3885,8 +3885,11 @@ int Tree::get_column_width(int p_column) const {
}
ERR_FAIL_COND_V(expanding_columns == 0, -1); // shouldn't happen
-
- return expand_area * get_column_minimum_width(p_column) / expanding_total;
+ if (expanding_total == 0) {
+ return 0;
+ } else {
+ return expand_area * get_column_minimum_width(p_column) / expanding_total;
+ }
} else {
return get_column_minimum_width(p_column);
}