From c846c0fbdcf77c5b370fdcdca64629da86a48815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Mon, 30 Nov 2020 18:46:48 +0100 Subject: [PATCH] testclangimport.cpp: fixed potential nullptr dereference in parse() (#2927) --- test/testclangimport.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/testclangimport.cpp b/test/testclangimport.cpp index 8dc4eb370..5954e55a8 100644 --- a/test/testclangimport.cpp +++ b/test/testclangimport.cpp @@ -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); }