testclangimport.cpp: fixed potential nullptr dereference in parse() (#2927)

This commit is contained in:
Oliver Stöneberg 2020-11-30 18:46:48 +01:00 committed by GitHub
parent 8a1c16a560
commit c846c0fbdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -127,6 +127,9 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(clang);
clangimport::parseClangAstDump(&tokenizer, istr);
if (!tokenizer.tokens()) {
return std::string();
}
return tokenizer.tokens()->stringifyList(true, false, false, false, false);
}