summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-03-18 20:34:08 +0100
committerGitHub <noreply@github.com>2021-03-18 20:34:08 +0100
commit8a7e503337127f5d50966bcc4ed16f009bea7212 (patch)
treea5cd93018ba2c8cfcc9beb2d3c4957aa70ad3ab9 /scene
parent2274d4eebc5b0af3c59a9b0ea7877d9fd729dfc4 (diff)
parentfa6fd3a2d075c9e9b831f22cf8a5b5de8d24f168 (diff)
Merge pull request #47115 from jcsho/fix-tree-null-stylebox
Check for null pointer in get_column_width(0)
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/tree.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 6ac4d7fd2f..6f51a61329 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3506,9 +3506,13 @@ int Tree::get_column_width(int p_column) const {
return columns[p_column].min_width;
}
+ int expand_area = get_size().width;
+
Ref<StyleBox> bg = cache.bg;
- int expand_area = get_size().width - (bg->get_margin(SIDE_LEFT) + bg->get_margin(SIDE_RIGHT));
+ if (bg.is_valid()) {
+ expand_area -= bg->get_margin(SIDE_LEFT) + bg->get_margin(SIDE_RIGHT);
+ }
if (v_scroll->is_visible_in_tree()) {
expand_area -= v_scroll->get_combined_minimum_size().width;