From ceb1b4ababfd319115d32ff47da40ab213b003e3 Mon Sep 17 00:00:00 2001 From: Bruno Bigras Date: Tue, 19 Jan 2010 11:45:50 -0500 Subject: [PATCH] Prevent quasselclient from crashing when there's no account yet --- src/client/coreaccountmodel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/coreaccountmodel.cpp b/src/client/coreaccountmodel.cpp index 1ab159c8..a7a2f017 100644 --- a/src/client/coreaccountmodel.cpp +++ b/src/client/coreaccountmodel.cpp @@ -39,11 +39,13 @@ CoreAccountModel::CoreAccountModel(const CoreAccountModel *other, QObject *paren void CoreAccountModel::update(const CoreAccountModel *other) { clear(); - beginInsertRows(QModelIndex(), 0, other->_accounts.count() -1); + if (other->_accounts.count() > 0) { + beginInsertRows(QModelIndex(), 0, other->_accounts.count() -1); + _accounts = other->_accounts; + endInsertRows(); + } _internalAccount = other->internalAccount(); - _accounts = other->_accounts; _removedAccounts = other->_removedAccounts; - endInsertRows(); } void CoreAccountModel::load() { -- 2.20.1