SymbolDatabase: Fix cleanup (avoid dead pointers)

This commit is contained in:
Daniel Marjamäki 2016-05-08 18:34:23 +02:00
parent 6f1af2cf0a
commit e99a9b4742
1 changed files with 1 additions and 1 deletions

View File

@ -1302,7 +1302,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
SymbolDatabase::~SymbolDatabase()
{
// Clear scope, type, function and variable pointers
for (const Token* tok = _tokenizer->list.front(); tok != _tokenizer->list.back(); tok = tok->next()) {
for (const Token* tok = _tokenizer->list.front(); tok; tok = tok->next()) {
const_cast<Token *>(tok)->scope(0);
const_cast<Token *>(tok)->type(0);
const_cast<Token *>(tok)->function(0);