fix #3013 (segmentation fault of cppcheck ( struct x : virtual y ))
This commit is contained in:
parent
dd666b7c1b
commit
88019658b4
|
@ -1259,7 +1259,7 @@ const Token *SymbolDatabase::initBaseInfo(Scope *scope, const Token *tok)
|
|||
base.scope = 0;
|
||||
|
||||
// add unhandled templates
|
||||
if (tok2->next()->str() == "<")
|
||||
if (tok2->next() && tok2->next()->str() == "<")
|
||||
{
|
||||
tok2 = tok2->next();
|
||||
base.name += tok2->str();
|
||||
|
|
|
@ -122,6 +122,7 @@ private:
|
|||
TEST_CASE(symboldatabase17); // ticket #2657
|
||||
TEST_CASE(symboldatabase18); // ticket #2865
|
||||
TEST_CASE(symboldatabase19); // ticket #2991 (segmentation fault)
|
||||
TEST_CASE(symboldatabase20); // ticket #3013 (segmentation fault)
|
||||
}
|
||||
|
||||
void test_isVariableDeclarationCanHandleNull()
|
||||
|
@ -887,6 +888,14 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase20()
|
||||
{
|
||||
// ticket #3013 - segmentation fault
|
||||
check("struct x : virtual y\n");
|
||||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSymbolDatabase)
|
||||
|
|
Loading…
Reference in New Issue