Commit 109c10c2 authored by David Faure's avatar David Faure
Browse files

Replace assert with early return, in case the collection was deleted meanwhile.

Another comment in the same file says
 // Do not assert on invalid collections, since a collection may be deleted
 // in the meantime and deleted collections are invalid.
Therefore it looks like this is expected.
parent e4c181f2
......@@ -208,7 +208,7 @@ void CollectionStatisticsDelegate::paint(QPainter *painter,
// in initStyleOption(), which gets called by QStyledItemDelegate::paint().
QStyledItemDelegate::paint(painter, option, index);
// No, we retrieve the correct style option by calling intiStyleOption from
// Now, we retrieve the correct style option by calling initStyleOption from
// the superclass.
QStyleOptionViewItemV4 option4 = option;
QStyledItemDelegate::initStyleOption(&option4, index);
......@@ -235,10 +235,9 @@ void CollectionStatisticsDelegate::paint(QPainter *painter,
if (!collection.isValid()) {
qCCritical(AKONADIWIDGETS_LOG) << "Invalid collection: " << collection;
Q_ASSERT(collection.isValid()); // TODO: I seem to hit this when removing a duplicated "Personal Contacts" or "Personal Calendar"
CollectionStatistics statistics = collection.statistics();
qint64 unreadCount = qMax(0LL, statistics.unreadCount());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment