Fixed ticket #3543 (segmentation fault of cppcheck).
This commit is contained in:
parent
aaa6070fc9
commit
bc034095f1
|
@ -324,6 +324,8 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
|||
// find start of function '{'
|
||||
while (end && end->str() != "{")
|
||||
end = end->next();
|
||||
if (!end)
|
||||
continue;
|
||||
|
||||
// save start of function
|
||||
function.start = end;
|
||||
|
|
|
@ -153,6 +153,7 @@ private:
|
|||
TEST_CASE(symboldatabase24); // ticket #3508 (constructor, destructor)
|
||||
TEST_CASE(symboldatabase25); // ticket #3561 (throw C++)
|
||||
TEST_CASE(symboldatabase26); // ticket #3561 (throw C)
|
||||
TEST_CASE(symboldatabase27); // ticket #3543 (segmentation fault)
|
||||
}
|
||||
|
||||
void test_isVariableDeclarationCanHandleNull() {
|
||||
|
@ -1118,6 +1119,16 @@ private:
|
|||
ASSERT(db && db->getVariableListSize() == 2); // index 0 + 1 variable
|
||||
}
|
||||
|
||||
// #ticket #3543 (segmentation fault)
|
||||
void symboldatabase27() {
|
||||
check("class C : public B1\n"
|
||||
"{\n"
|
||||
" B1()\n"
|
||||
" {} C(int) : B1() class\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSymbolDatabase)
|
||||
|
|
Loading…
Reference in New Issue