diff --git a/src/app/cli/Cli.cpp b/src/app/cli/Cli.cpp index ce77c3e78..ede8a5d14 100644 --- a/src/app/cli/Cli.cpp +++ b/src/app/cli/Cli.cpp @@ -125,8 +125,11 @@ static void cliInitiateConference (QHash &args) { const QString id = args["conference-id"]; auto updateCallsWindow = []() { - // TODO: Set the view to the "waiting call view". QQuickWindow *callsWindow = App::getInstance()->getCallsWindow(); + if (!callsWindow) + return; + + // TODO: Set the view to the "waiting call view". if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) { if (!callsWindow->isVisible()) callsWindow->showMinimized(); diff --git a/src/components/call/CallModel.cpp b/src/components/call/CallModel.cpp index 06a656845..18ad3a618 100644 --- a/src/components/call/CallModel.cpp +++ b/src/components/call/CallModel.cpp @@ -339,12 +339,13 @@ void CallModel::accept (bool withVideo) { setRecordFile(params); QQuickWindow *callsWindow = App::getInstance()->getCallsWindow(); - if (coreManager->getSettingsModel()->getKeepCallsWindowInBackground()) { - if (!callsWindow->isVisible()) - callsWindow->showMinimized(); - } else - App::smartShowWindow(callsWindow); - + if (callsWindow) { + if (coreManager->getSettingsModel()->getKeepCallsWindowInBackground()) { + if (!callsWindow->isVisible()) + callsWindow->showMinimized(); + } else + App::smartShowWindow(callsWindow); + } mCall->acceptWithParams(params); } diff --git a/src/components/calls/CallsListModel.cpp b/src/components/calls/CallsListModel.cpp index 60db77228..76688a137 100644 --- a/src/components/calls/CallsListModel.cpp +++ b/src/components/calls/CallsListModel.cpp @@ -230,11 +230,13 @@ bool CallsListModel::removeRows (int row, int count, const QModelIndex &parent) void CallsListModel::addCall (const shared_ptr &call) { if (call->getDir() == linphone::CallDirOutgoing) { QQuickWindow *callsWindow = App::getInstance()->getCallsWindow(); - if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) { - if (!callsWindow->isVisible()) - callsWindow->showMinimized(); - } else - App::smartShowWindow(callsWindow); + if (callsWindow) { + if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) { + if (!callsWindow->isVisible()) + callsWindow->showMinimized(); + } else + App::smartShowWindow(callsWindow); + } } CallModel *callModel = new CallModel(call); diff --git a/src/components/chat/ChatProxyModel.cpp b/src/components/chat/ChatProxyModel.cpp index 190c2cfd4..a71fdbeff 100644 --- a/src/components/chat/ChatProxyModel.cpp +++ b/src/components/chat/ChatProxyModel.cpp @@ -69,9 +69,12 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent) QObject::connect(app->getMainWindow(), &QWindow::activeChanged, this, [this]() { handleIsActiveChanged(App::getInstance()->getMainWindow()); }); - QObject::connect(app->getCallsWindow(), &QWindow::activeChanged, this, [this]() { - handleIsActiveChanged(App::getInstance()->getCallsWindow()); - }); + + QQuickWindow *callsWindow = app->getCallsWindow(); + if (callsWindow) + QObject::connect(callsWindow, &QWindow::activeChanged, this, [this, callsWindow]() { + handleIsActiveChanged(callsWindow); + }); } // -----------------------------------------------------------------------------