forked from qt-creator/qt-creator
C++: Fix crash when accessing an empty list in Rewrite
Task-number: QTCREATORBUG-14163 Change-Id: I57eca70466bbf5d28d16afafc07ab243206fcff5 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -63,8 +63,10 @@ public:
|
|||||||
{
|
{
|
||||||
TypeVisitor::accept(ty.type());
|
TypeVisitor::accept(ty.type());
|
||||||
unsigned flags = ty.flags();
|
unsigned flags = ty.flags();
|
||||||
flags |= temps.back().flags();
|
if (!temps.isEmpty()) {
|
||||||
temps.back().setFlags(flags);
|
flags |= temps.back().flags();
|
||||||
|
temps.back().setFlags(flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -73,7 +75,7 @@ public:
|
|||||||
FullySpecifiedType operator()(const FullySpecifiedType &ty)
|
FullySpecifiedType operator()(const FullySpecifiedType &ty)
|
||||||
{
|
{
|
||||||
accept(ty);
|
accept(ty);
|
||||||
return temps.takeLast();
|
return (!temps.isEmpty()) ? temps.takeLast() : ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(UndefinedType *)
|
virtual void visit(UndefinedType *)
|
||||||
@@ -241,7 +243,7 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
accept(name);
|
accept(name);
|
||||||
return temps.takeLast();
|
return (!temps.isEmpty()) ? temps.takeLast() : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(const QualifiedNameId *name)
|
virtual void visit(const QualifiedNameId *name)
|
||||||
|
Reference in New Issue
Block a user