Item: Improve assert, don't dereference nullptr

This commit is contained in:
Sergio Martins
2020-05-16 12:33:09 +01:00
parent 2984b62ca0
commit d2716cf1c5

View File

@@ -577,9 +577,13 @@ void Item::setGeometry(QRect rect)
if (rect.isEmpty()) {
// Just a sanity check...
ItemContainer *c = asContainer();
if (c->hasVisibleChildren()) {
if (auto r = root()) r->dumpLayout();
Q_ASSERT(false);
if (c) {
if (c->hasVisibleChildren()) {
if (auto r = root()) r->dumpLayout();
Q_ASSERT(false);
}
} else {
qWarning() << Q_FUNC_INFO << "Empty rect";
}
}