From fec3ef202f620808fdd5de5697c68bba88edd601 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 6 Aug 2021 14:12:17 +0200 Subject: [PATCH] AutoTest: Prevent potential nullptr access Change-Id: I78eb4a5113d23273e9383c86fdefcffea05e0123 Reviewed-by: Christian Kandeler --- src/plugins/autotest/testtreemodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/autotest/testtreemodel.cpp b/src/plugins/autotest/testtreemodel.cpp index da6da812d6b..b6f979fe335 100644 --- a/src/plugins/autotest/testtreemodel.cpp +++ b/src/plugins/autotest/testtreemodel.cpp @@ -732,6 +732,8 @@ void TestTreeModel::handleParseResult(const TestParseResult *result, TestTreeIte // restore former check state and fail state if available newItem->forAllChildItems([this](TestTreeItem *childItem) { + if (!m_checkStateCache) // parse results may arrive after session switch / project close + return; Utils::optional cached = m_checkStateCache->get(childItem); if (cached.has_value()) childItem->setData(0, cached.value(), Qt::CheckStateRole);