From fa6fd3a2d075c9e9b831f22cf8a5b5de8d24f168 Mon Sep 17 00:00:00 2001 From: Justin Ho Date: Wed, 17 Mar 2021 12:10:36 -0700 Subject: Check for null pointer in get_column_width(0) --- scene/gui/tree.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scene') 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 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; -- cgit v1.2.3