AST: create possible NULL pointer dereference if tokenlist is empty. Ticket: #4630

This commit is contained in:
Daniel Marjamki 2013-03-02 15:49:48 +01:00
parent b9aba17b23
commit c4419ea920
1 changed files with 4 additions and 0 deletions

View File

@ -376,6 +376,10 @@ void TokenList::createAst()
" [ " " [ "
}; };
// No tokens => bail out
if (!_front)
return;
for (unsigned int i = 0; i < sizeof(operators) / sizeof(*operators); ++i) { for (unsigned int i = 0; i < sizeof(operators) / sizeof(*operators); ++i) {
// TODO: extract operators to std::set - that should be faster // TODO: extract operators to std::set - that should be faster
if (*operators[i] == '>') { // Unary operators, parse from right to left if (*operators[i] == '>') { // Unary operators, parse from right to left