-rw-r--r-- | korganizer/koagendaitem.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 0f9a38f..d38cb00 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -115,17 +115,18 @@ void KOAgendaItem::initColor () ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date()) mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; else mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; } else { QStringList categories = mIncidence->categories(); - QString cat = categories.first(); + QString cat; + if(!categories.isEmpty()) cat = categories.first(); if (cat.isEmpty()) { if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; else mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); } else { mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { |