Fixed crash on garbage code (#7074)
This commit is contained in:
parent
34ec1112a9
commit
636bf75799
|
@ -1158,7 +1158,7 @@ bool Token::isUnaryPreOp() const
|
|||
return true;
|
||||
const Token *tokbefore = _previous;
|
||||
const Token *tokafter = _next;
|
||||
for (int distance = 1; distance < 10; distance++) {
|
||||
for (int distance = 1; distance < 10 && tokbefore; distance++) {
|
||||
if (tokbefore == _astOperand1)
|
||||
return false;
|
||||
if (tokafter == _astOperand1)
|
||||
|
|
|
@ -193,6 +193,7 @@ private:
|
|||
TEST_CASE(garbageCode142); // #7050
|
||||
TEST_CASE(garbageCode143); // #6922
|
||||
TEST_CASE(garbageCode144); // #6865
|
||||
TEST_CASE(garbageCode145); // #7074
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -1138,6 +1139,10 @@ private:
|
|||
//ASSERT_THROW(checkCode("template < typename > struct A { } ; template < typename > struct A < INVALID > : A < int[ > { }] ;"), InternalError);
|
||||
}
|
||||
|
||||
void garbageCode145() { // #7074
|
||||
checkCode("++4++ + + E++++++++++ + ch " "tp.oed5[.]");
|
||||
}
|
||||
|
||||
void garbageValueFlow() {
|
||||
// #6089
|
||||
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
||||
|
|
Loading…
Reference in New Issue