Avoid crash in property requirements test

Pure QML types do not have a meta object hierarchy associated with them.
The test is only supposed to test C++ types, though. We can ignore the
types without meta objects.

Change-Id: I2a40bc0023f6d335c4dbdbc04818da60f47d8787
Fixes: QTBUG-72637
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Ulf Hermann 2019-01-07 13:13:43 +01:00
parent 5ed082ea4c
commit 0999c78ea3
1 changed files with 3 additions and 1 deletions

View File

@ -175,8 +175,10 @@ void tst_PropertyRequirements::testQmlType(TestDepth testDepth, const QQmlType &
// check if this type is derived from QObject and even can have signals
// i.e. weed out the Q_GADGET classes
if (inheritanceHierarchy.first()->className() != QByteArray("QObject"))
if (inheritanceHierarchy.isEmpty()
|| inheritanceHierarchy.constFirst()->className() != QByteArrayLiteral("QObject")) {
return;
}
if (testDepth == MainTypeOnly) {
inheritanceHierarchy.clear();