From 7b1fa0b22598305b8c50fda543131d2d14d1df63 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Mon, 12 Jul 2021 12:48:28 +0200 Subject: Don't crash on startup if the session service isn't reachable. --- src/scenes/add_server_wizard/add_server_wizard.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/scenes') diff --git a/src/scenes/add_server_wizard/add_server_wizard.cpp b/src/scenes/add_server_wizard/add_server_wizard.cpp index e398b19..9b67ebc 100644 --- a/src/scenes/add_server_wizard/add_server_wizard.cpp +++ b/src/scenes/add_server_wizard/add_server_wizard.cpp @@ -67,6 +67,15 @@ void Add_Server_wizard::add_server(QString host_url, QString host_alias) { } void Add_Server_wizard::add_web_app_host_response(QJsonDocument *doc) { + // Q_ASSERT lets the program crash immediatly at startup, + // when the session service is not started. + // Don't use Q_ASSERT(doc != nullptr); instead use: + if (doc == nullptr) { + _main_gui->setRWAHostSelected(false); + _main_gui->showToast(tr("Can't connect to underlying session service!"), 9800); + return; + } + // Get the QJsonObject QJsonObject jObject = doc->object(); QVariantMap mainMap = jObject.toVariantMap(); -- cgit v1.2.3