From 12c404bd1896f47557c88441aebcc65cb9f3f71e Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Wed, 11 Sep 2019 16:02:50 -0400 Subject: [PATCH] fix: catch exception on invalid account creation Change-Id: Iafffd0d256e261f80252a14732afee8c3508f28c --- callwidget.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/callwidget.cpp b/callwidget.cpp index c3ab92c..49f3cfb 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -1232,20 +1232,26 @@ CallWidget::updateConversationForNewContact(const std::string& convUid) void CallWidget::updateSmartList() { - if (!ui->smartList->model()) { - smartListModel_.reset(new SmartListModel(LRCInstance::getCurrAccId(), this)); - ui->smartList->setModel(smartListModel_.get()); - ui->smartList->setItemDelegate(new ConversationItemDelegate()); - } else { - smartListModel_->setAccount(LRCInstance::getCurrAccId()); - } - // smartlist selection - QObject::disconnect(smartlistSelectionConnection_); - smartlistSelectionConnection_ = connect(ui->smartList->selectionModel(), - SIGNAL(selectionChanged(QItemSelection, QItemSelection)), - this, - SLOT(smartListSelectionChanged(QItemSelection, QItemSelection))); + try { + if (!ui->smartList->model()) { + smartListModel_.reset(new SmartListModel(LRCInstance::getCurrAccId(), this)); + ui->smartList->setModel(smartListModel_.get()); + ui->smartList->setItemDelegate(new ConversationItemDelegate()); + } else { + smartListModel_->setAccount(LRCInstance::getCurrAccId()); + } + + // smartlist selection + QObject::disconnect(smartlistSelectionConnection_); + smartlistSelectionConnection_ = connect(ui->smartList->selectionModel(), + SIGNAL(selectionChanged(QItemSelection, QItemSelection)), + this, + SLOT(smartListSelectionChanged(QItemSelection, QItemSelection))); + } catch (...) { + qWarning() << "No account selected!"; + return; + } } void -- GitLab