main: do not crash if we can't load some stuff

This happens with some Qt widgets/components aren't found
This commit is contained in:
moneromooo.monero 2018-03-03 23:01:03 +00:00
parent 986275c42c
commit f45b0a7d25

View file

@ -255,7 +255,17 @@ int main(int argc, char *argv[])
// Load main window (context properties needs to be defined obove this line)
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
if (engine.rootObjects().isEmpty())
{
qCritical() << "Error: no root objects";
return 1;
}
QObject *rootObject = engine.rootObjects().first();
if (!rootObject)
{
qCritical() << "Error: no root objects";
return 1;
}
#ifdef WITH_SCANNER
QObject *qmlCamera = rootObject->findChild<QObject*>("qrCameraQML");