Commit da67c7c6 authored by Lorenz Haas's avatar Lorenz Haas

C++: Fix crash when accessing an empty list in Rewrite

Task-number: QTCREATORBUG-14163
Change-Id: I57eca70466bbf5d28d16afafc07ab243206fcff5
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent c097867f
......@@ -63,8 +63,10 @@ public:
{
TypeVisitor::accept(ty.type());
unsigned flags = ty.flags();
flags |= temps.back().flags();
temps.back().setFlags(flags);
if (!temps.isEmpty()) {
flags |= temps.back().flags();
temps.back().setFlags(flags);
}
}
public:
......@@ -73,7 +75,7 @@ public:
FullySpecifiedType operator()(const FullySpecifiedType &ty)
{
accept(ty);
return temps.takeLast();
return (!temps.isEmpty()) ? temps.takeLast() : ty;
}
virtual void visit(UndefinedType *)
......@@ -241,7 +243,7 @@ public:
return 0;
accept(name);
return temps.takeLast();
return (!temps.isEmpty()) ? temps.takeLast() : name;
}
virtual void visit(const QualifiedNameId *name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment