forked from qt-creator/qt-creator
AutoTest: Prevent potential nullptr access
Change-Id: I78eb4a5113d23273e9383c86fdefcffea05e0123 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -732,6 +732,8 @@ void TestTreeModel::handleParseResult(const TestParseResult *result, TestTreeIte
|
|||||||
|
|
||||||
// restore former check state and fail state if available
|
// restore former check state and fail state if available
|
||||||
newItem->forAllChildItems([this](TestTreeItem *childItem) {
|
newItem->forAllChildItems([this](TestTreeItem *childItem) {
|
||||||
|
if (!m_checkStateCache) // parse results may arrive after session switch / project close
|
||||||
|
return;
|
||||||
Utils::optional<Qt::CheckState> cached = m_checkStateCache->get(childItem);
|
Utils::optional<Qt::CheckState> cached = m_checkStateCache->get(childItem);
|
||||||
if (cached.has_value())
|
if (cached.has_value())
|
||||||
childItem->setData(0, cached.value(), Qt::CheckStateRole);
|
childItem->setData(0, cached.value(), Qt::CheckStateRole);
|
||||||
|
Reference in New Issue
Block a user