Fixed Access Violation with --enable=style when no tokens exist

This commit is contained in:
firewave 2010-04-25 12:35:09 +02:00
parent f1d1d60924
commit 52b84963e6
1 changed files with 2 additions and 1 deletions

View File

@ -45,7 +45,8 @@ CheckOther instance;
void CheckOther::warningOldStylePointerCast()
{
if (!_settings->_checkCodingStyle || _tokenizer->fileLine(_tokenizer->tokens()).find(".cpp") == std::string::npos)
if (!_settings->_checkCodingStyle ||
(_tokenizer->tokens() && _tokenizer->fileLine(_tokenizer->tokens()).find(".cpp") == std::string::npos))
return;
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())