AutoTest: Avoid possible nullptr access

Fixes a crash when loading qtdeclarative and parsing
for Qt Quick tests.

Fixes: QTCREATORBUG-23864
Change-Id: I0c88908f578e2dd92341a6fdd427aed5157bb94b
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Richard Weickelt <richard@weickelt.de>
This commit is contained in:
Christian Stenger
2020-04-15 13:33:44 +02:00
parent 54f76d29c0
commit cae7b16a90

View File

@@ -212,6 +212,8 @@ bool QuickTestAstVisitor::visit(CPlusPlus::CallAST *ast)
if (expressionListAST && expressionListAST->value) { if (expressionListAST && expressionListAST->value) {
const auto *stringLitAST = expressionListAST->value->asStringLiteral(); const auto *stringLitAST = expressionListAST->value->asStringLiteral();
if (!stringLitAST)
return false;
const auto *string const auto *string
= translationUnit()->stringLiteral(stringLitAST->literal_token); = translationUnit()->stringLiteral(stringLitAST->literal_token);
if (string) { if (string) {