Commit 0c4e121d authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Guard against calling a null object

BUG: 394543
parent fd4f6382
......@@ -154,13 +154,18 @@ QStringList DiscoverObject::modes() const
void DiscoverObject::openMode(const QString& _mode)
{
QObject* obj = rootObject();
if (!obj) {
qWarning() << "could not get the main object";
return;
}
if(!modes().contains(_mode))
qWarning() << "unknown mode" << _mode;
QString mode = _mode;
mode[0] = mode[0].toUpper();
QObject* obj = rootObject();
const QByteArray propertyName = "top"+mode.toLatin1()+"Comp";
const QVariant modeComp = obj->property(propertyName.constData());
if (!modeComp.isValid())
......
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