Fixed #2793 (SIGABRT on filenames without file extension)

This commit is contained in:
Moritz Lipp 2011-07-31 18:35:28 +02:00 committed by Daniel Marjamäki
parent 4433e621f8
commit 8d68981119
1 changed files with 8 additions and 3 deletions

View File

@ -3194,9 +3194,14 @@ void CheckOther::checkMisusedScopedObject()
// Skip this check for .c files
{
const std::string fname = _tokenizer->getFiles()->at(0);
const std::string ext = fname.substr(fname.rfind("."));
if (ext == ".c" || ext == ".C")
return;
size_t position = fname.rfind(".");
if (position != std::string::npos)
{
const std::string ext = fname.substr(position);
if (ext == ".c" || ext == ".C")
return;
}
}
const SymbolDatabase * const symbolDatabase = _tokenizer->getSymbolDatabase();