Commit a3b984f0 authored by Andreas Traczyk's avatar Andreas Traczyk

fix crash on app start

Change-Id: I1e2c14fe4b7ae0f133fe6a23a12ae301ab6b5408
parent 0b7bd311
......@@ -46,8 +46,28 @@ VideoOverlay::VideoOverlay(QWidget* parent) :
ui->onHoldLabel->setVisible(false);
connect(LRCInstance::getCurrentCallModel(), &lrc::api::NewCallModel::callStarted,
[this](const std::string& tempCallId) { callId = tempCallId; });
auto accountList = LRCInstance::accountModel().getAccountList();
if (!accountList.size()) {
QMetaObject::Connection* const connection = new QMetaObject::Connection;
connect(&LRCInstance::accountModel(),
&lrc::api::NewAccountModel::accountAdded,
[this, connection](const std::string& accountId) {
Q_UNUSED(accountId);
connect(LRCInstance::getCurrentCallModel(), &lrc::api::NewCallModel::callStarted,
[this](const std::string& tempCallId) {
callId = tempCallId;
});
QObject::disconnect(*connection);
if (connection) {
delete connection;
}
});
} else {
connect(LRCInstance::getCurrentCallModel(), &lrc::api::NewCallModel::callStarted,
[this](const std::string& tempCallId) {
callId = tempCallId;
});
}
connect(oneSecondTimer_, &QTimer::timeout, this, &VideoOverlay::setTime);
oneSecondTimer_->start(1000);
......
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