diff --git a/dialer/src/dialerutils.cpp b/dialer/src/dialerutils.cpp index 83d462df..18de8790 100644 --- a/dialer/src/dialerutils.cpp +++ b/dialer/src/dialerutils.cpp @@ -38,6 +38,10 @@ DialerUtils::DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent) m_callDuration(0), m_callContactAlias(QString()) { + if (!m_simAccount) { + return; + } + Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore); connect(op, &Tp::PendingOperation::finished, [=](){ @@ -56,13 +60,17 @@ void DialerUtils::dial(const QString &number) { // FIXME: this should be replaced by kpeople thing qDebug() << "Starting call..."; - Tp::PendingChannelRequest *pendingChannel = m_simAccount->ensureAudioCall(number); - connect(pendingChannel, &Tp::PendingChannelRequest::finished, pendingChannel, [=](){ - if (pendingChannel->isError()) { - qWarning() << "Error when requesting channel" << pendingChannel->errorMessage(); - setCallState("failed"); - } - }); + if (m_simAccount) { + Tp::PendingChannelRequest *pendingChannel = m_simAccount->ensureAudioCall(number); + connect(pendingChannel, &Tp::PendingChannelRequest::finished, pendingChannel, [=](){ + if (pendingChannel->isError()) { + qWarning() << "Error when requesting channel" << pendingChannel->errorMessage(); + setCallState("failed"); + } + }); + } else { + setCallState("failed"); + } } QString DialerUtils::callState() const diff --git a/dialer/src/main.cpp b/dialer/src/main.cpp index b7af3624..f21e24a4 100644 --- a/dialer/src/main.cpp +++ b/dialer/src/main.cpp @@ -165,7 +165,6 @@ int main(int argc, char **argv) if (simAccount.isNull()) { qCritical() << "Unable to get SIM account"; - return -1; } QQmlApplicationEngine engine;