From 9d54303cfabd9f998a12fa866055c6b53977004f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 26 Dec 2020 19:59:57 +0100 Subject: [PATCH] Clang import; Fixed segmentation fault --- lib/clangimport.cpp | 2 +- lib/symboldatabase.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/clangimport.cpp b/lib/clangimport.cpp index 4cc12ebe7..a180b5887 100644 --- a/lib/clangimport.cpp +++ b/lib/clangimport.cpp @@ -1491,7 +1491,7 @@ void clangimport::parseClangAstDump(Tokenizer *tokenizer, std::istream &f) } const int level = (pos1 - 1) / 2; - if (level == 0 || tree.empty()) + if (level == 0 || level > tree.size()) continue; AstNodePtr newNode = std::make_shared(nodeType, ext, &data); diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 974f83aac..9a3a549c0 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -5912,7 +5912,7 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V } type = type->next(); } - if (type->str() == "(" && type->previous()->function()) + if (type && type->str() == "(" && type->previous()->function()) // we are past the end of the type type = type->previous(); continue;