Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

AST: create possible NULL pointer dereference if tokenlist is empty. …

…Ticket: #4630
  • Loading branch information...
commit c4419ea92048741d64b06ff2534ec491619d8b73 1 parent b9aba17
Daniel Marjamäki authored

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  lib/tokenlist.cpp
4  lib/tokenlist.cpp
@@ -376,6 +376,10 @@ void TokenList::createAst()
376 376
         " [ "
377 377
     };
378 378
 
  379
+    // No tokens => bail out
  380
+    if (!_front)
  381
+        return;
  382
+
379 383
     for (unsigned int i = 0; i < sizeof(operators) / sizeof(*operators); ++i) {
380 384
         // TODO: extract operators to std::set - that should be faster
381 385
         if (*operators[i] == '>') {  // Unary operators, parse from right to left

0 notes on commit c4419ea

Please sign in to comment.
Something went wrong with that request. Please try again.