AutoTest: Fix possible crash

Do not access list items if there are none.
Amends 502ad9badb.

Fixes: QTCREATORBUG-24421
Change-Id: I2982f675bba36eac98cb116acf64472a9f415977
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2020-08-04 08:21:26 +02:00
parent 32f71ca8ff
commit c25a40f6ed

View File

@@ -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