From c5fad3756006429026165a345b9eadcd4b5425df Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 19 May 2015 11:00:45 +0200 Subject: [PATCH] Avoid null pointer access Change-Id: Ie6f64a97d1d97efaa1e1f3ea784a119981159e62 Reviewed-by: David Schulz --- plugins/autotest/testtreemodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 2ee021ad06b..134a9dc2141 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -598,7 +598,8 @@ QList TestTreeModel::getSelectedTests() const QString TestTreeModel::getMainFileForUnnamedQuickTest(const QString &qmlFile) const { const TestTreeItem *unnamed = unnamedQuickTests(); - for (int row = 0, count = unnamed->childCount(); row < count; ++row) { + const int count = unnamed ? unnamed->childCount() : 0; + for (int row = 0; row < count; ++row) { const TestTreeItem *child = unnamed->child(row); if (qmlFile == child->filePath()) return child->mainFile();