aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2020-08-04 08:21:26 +0200
committerChristian Stenger <christian.stenger@qt.io>2020-08-10 05:13:41 +0000
commitc25a40f6ed77b2af70a63b6740ef293947483de5 (patch)
tree243301cd57885eed65571b8c92cbe6cffb6d726c
parent32f71ca8ffc317a0844fe910bfa32fa84737433f (diff)
AutoTest: Fix possible crash
Do not access list items if there are none. Amends 502ad9badb731. Fixes: QTCREATORBUG-24421 Change-Id: I2982f675bba36eac98cb116acf64472a9f415977 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/autotest/testconfiguration.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp
index c5ff920260..10709e38a6 100644
--- a/src/plugins/autotest/testconfiguration.cpp
+++ b/src/plugins/autotest/testconfiguration.cpp
@@ -151,7 +151,8 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
if (buildTargets.size() > 1 ) // there are multiple executables with the same build target
return; // let the user decide which one to run
- const BuildTargetInfo targetInfo = buildTargets.first();
+ const BuildTargetInfo targetInfo = buildTargets.size() ? buildTargets.first()
+ : BuildTargetInfo();
// we might end up with an empty targetFilePath - e.g. when having a library we just link to
// there would be no BuildTargetInfo that could match