Moc: test if superclass list is not empty before accessing first()
Accessing QList().first() with an empty superclassList caused assertion fail. Added check to fix it. Change-Id: I1aff35e0d267fc0e670beadba1bd196b175a4da8 Co-authored-with: Olivier Goffart <ogoffart@woboq.com> Task-number: QTBUG-45790 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
2886935f96
commit
0635b1a69d
@ -140,7 +140,8 @@ bool Moc::parseClassHead(ClassDef *def)
|
|||||||
}
|
}
|
||||||
} while (test(COMMA));
|
} while (test(COMMA));
|
||||||
|
|
||||||
if (knownGadgets.contains(def->superclassList.first().first)) {
|
if (!def->superclassList.isEmpty()
|
||||||
|
&& knownGadgets.contains(def->superclassList.first().first)) {
|
||||||
// Q_GADGET subclasses are treated as Q_GADGETs
|
// Q_GADGET subclasses are treated as Q_GADGETs
|
||||||
knownGadgets.insert(def->classname, def->qualified);
|
knownGadgets.insert(def->classname, def->qualified);
|
||||||
knownGadgets.insert(def->qualified, def->qualified);
|
knownGadgets.insert(def->qualified, def->qualified);
|
||||||
|
@ -83,6 +83,10 @@ QT_USE_NAMESPACE
|
|||||||
template <bool b> struct QTBUG_31218 {};
|
template <bool b> struct QTBUG_31218 {};
|
||||||
struct QTBUG_31218_Derived : QTBUG_31218<-1<0> {};
|
struct QTBUG_31218_Derived : QTBUG_31218<-1<0> {};
|
||||||
|
|
||||||
|
#if defined(Q_MOC_RUN)
|
||||||
|
class QTBUG_45790 : Bug() { };
|
||||||
|
#endif
|
||||||
|
|
||||||
struct MyStruct {};
|
struct MyStruct {};
|
||||||
struct MyStruct2 {};
|
struct MyStruct2 {};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user