From d69c749aafa052331d3678d9b60eecbddd2dba2d Mon Sep 17 00:00:00 2001 From: cg2121 Date: Sat, 27 Aug 2022 23:02:31 -0500 Subject: [PATCH] UI: Fix crash with adding source Bug introduced with https://github.com/obsproject/obs-studio/commit/adba393ca85fba19ed1bf6cd825ab8188beb2d16 OBS would crash when adding a new source because the source tree item's widget would be NULL in the sizeHint function when the list item is first created. --- UI/source-tree.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UI/source-tree.cpp b/UI/source-tree.cpp index f02ec6d6f..a51de09e4 100644 --- a/UI/source-tree.cpp +++ b/UI/source-tree.cpp @@ -1757,5 +1757,8 @@ QSize SourceTreeDelegate::sizeHint(const QStyleOptionViewItem &, SourceTree *tree = qobject_cast(parent()); QWidget *item = tree->indexWidget(index); + if (!item) + return (QSize(0, 0)); + return (QSize(item->width(), item->height())); }