From c25a40f6ed77b2af70a63b6740ef293947483de5 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 4 Aug 2020 08:21:26 +0200 Subject: AutoTest: Fix possible crash Do not access list items if there are none. Amends 502ad9badb731. Fixes: QTCREATORBUG-24421 Change-Id: I2982f675bba36eac98cb116acf64472a9f415977 Reviewed-by: hjk --- src/plugins/autotest/testconfiguration.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3