From f45b0a7d25920f445d83d14415791dda48b8185c Mon Sep 17 00:00:00 2001 From: "moneromooo.monero" Date: Sat, 3 Mar 2018 23:01:03 +0000 Subject: [PATCH] main: do not crash if we can't load some stuff This happens with some Qt widgets/components aren't found --- main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.cpp b/main.cpp index 08bcb9e3..fba82fec 100644 --- a/main.cpp +++ b/main.cpp @@ -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("qrCameraQML");