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: ...@@ -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: ...@@ -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: ...@@ -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)
......
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