Fix #1485 (cppcheck.exe 1.41 crashes when calling with option --errorlist)

http://sourceforge.net/apps/trac/cppcheck/ticket/1485
This commit is contained in:
Reijo Tomperi 2010-03-08 22:40:50 +02:00
parent 525ed61831
commit a0d6da506b
1 changed files with 4 additions and 0 deletions

View File

@ -118,6 +118,10 @@ protected:
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList; std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it) for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it)
{ {
// --errorlist can provide null values here
if (!(*it))
continue;
ErrorLogger::ErrorMessage::FileLocation loc; ErrorLogger::ErrorMessage::FileLocation loc;
loc.line = (*it)->linenr(); loc.line = (*it)->linenr();
loc.file = _tokenizer->file(*it); loc.file = _tokenizer->file(*it);