瀏覽代碼

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.
cg2121 3 年之前
父節點
當前提交
d69c749aaf
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      UI/source-tree.cpp

+ 3 - 0
UI/source-tree.cpp

@@ -1757,5 +1757,8 @@ QSize SourceTreeDelegate::sizeHint(const QStyleOptionViewItem &,
 	SourceTree *tree = qobject_cast<SourceTree *>(parent());
 	QWidget *item = tree->indexWidget(index);
 
+	if (!item)
+		return (QSize(0, 0));
+
 	return (QSize(item->width(), item->height()));
 }