Clang import; Fixed segmentation fault

This commit is contained in:
Daniel Marjamäki 2020-12-26 19:59:57 +01:00
parent d024eb3ee0
commit 9d54303cfa
2 changed files with 2 additions and 2 deletions

View File

@ -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<AstNode>(nodeType, ext, &data);

View File

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