diff --git a/callwidget.cpp b/callwidget.cpp index c3ab92c9539ed0b9de3bb74e9d1b8e60c474089b..49f3cfbf53fec4e706c5a488ea151d9b1173c984 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