fix #2980 (segmentation fault of cppcheck)
This commit is contained in:
parent
403b508371
commit
afe95be966
|
@ -3751,7 +3751,7 @@ void Tokenizer::setVarId()
|
|||
|
||||
if (level == 1 && Token::Match(tok2, "> %var%"))
|
||||
tok = tok2;
|
||||
else if (level > 1 && tok2->str() == ">")
|
||||
else if (level > 1 && tok2 && tok2->str() == ">")
|
||||
{
|
||||
level--;
|
||||
if (level == 0)
|
||||
|
|
|
@ -181,6 +181,7 @@ private:
|
|||
TEST_CASE(varid33); // ticket #2875 (segmentation fault)
|
||||
TEST_CASE(varid34); // ticket #2825
|
||||
TEST_CASE(varid35); // ticket #2937
|
||||
TEST_CASE(varid36); // ticket #2980 (segmentation fault)
|
||||
TEST_CASE(varidFunctionCall1);
|
||||
TEST_CASE(varidFunctionCall2);
|
||||
TEST_CASE(varidFunctionCall3);
|
||||
|
@ -3016,6 +3017,13 @@ private:
|
|||
TODO_ASSERT_EQUALS(expected, actual, tokenizeDebugListing(code));
|
||||
}
|
||||
|
||||
void varid36() // ticket #2980 (segmentation fault)
|
||||
{
|
||||
const std::string code("#elif A\n"
|
||||
"A,a<b<x0;\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void varidFunctionCall1()
|
||||
{
|
||||
const std::string code("void f() {\n"
|
||||
|
|
Loading…
Reference in New Issue