ActivityListModel: attempt to fix a crash.
authorOlivier Goffart <ogoffart@woboq.com>
Thu, 16 Mar 2017 13:25:08 +0000 (14:25 +0100)
committerMarkus Goetz <markus@woboq.com>
Thu, 16 Mar 2017 13:31:15 +0000 (14:31 +0100)
The backtrace seems to indicate that the account is invalid.
I don't know how this can happen, maybe the account's display
name was changed while the app is running?

Backtrace:
Crash: EXC_BAD_ACCESS / KERN_INVALID_ADDRESS at 0x18
  Module "owncloud", in OCC::AccountState::account
  Module "owncloud", in OCC::ActivityListModel::data
  Module "owncloud", in OCC::ActivityItemDelegate::paint
  Module "QtWidgets", in QListView::paintEvent
  Module "QtWidgets", in QWidget::event
  Module "QtWidgets", in QFrame::event
  Module "QtWidgets", in QAbstractScrollArea::viewportEvent
  Module "QtWidgets", in QAbstractItemView::viewportEvent
  Module "QtWidgets", in QAbstractScrollAreaFilter::eventFilter
  Module "QtCore", in QCoreApplicationPrivate::sendThroughObjectEventFilters

src/gui/activitylistmodel.cpp

index f6658db0050b3ab9fd2b2e50e87e027a8247da3e..b4d213c8577b0f6487d73a7f338a569f2e76ddad 100644 (file)
@@ -47,6 +47,8 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
 
     a = _finalList.at(index.row());
     AccountStatePtr ast = AccountManager::instance()->account(a._accName);
+    if (!ast)
+        return QVariant();
     QStringList list;
 
     switch (role) {