diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 89311f052..fd073582d 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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())