summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <[email protected]>2015-11-03 17:35:51 +0100
committerDaniel Vrátil <[email protected]>2015-11-03 18:19:00 +0100
commit59ea6bac38ee438b62c925c221c915ebc2d49b5a (patch)
tree24e1ebb340ceeeb6bd7e017b8ff03c75103b18a9
parent81936f896a05d76728825b63c8fcf7443840bb14 (diff)
ResourceBase: check if we actually got the collection for retrieval
CollectionFetchJob returning empty collection list is not an error (unlike ItemFetchJob), so better check it before we try to access collections from the list.
-rw-r--r--akonadi/src/agentbase/resourcebase.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/akonadi/src/agentbase/resourcebase.cpp b/akonadi/src/agentbase/resourcebase.cpp
index b1a4287..d0a3660 100644
--- a/akonadi/src/agentbase/resourcebase.cpp
+++ b/akonadi/src/agentbase/resourcebase.cpp
@@ -944,7 +944,13 @@ void ResourceBasePrivate::slotItemRetrievalCollectionFetchDone(KJob *job)
return;
}
Akonadi::CollectionFetchJob *fetchJob = static_cast<Akonadi::CollectionFetchJob *>(job);
- q->retrieveItems(fetchJob->collections().at(0));
+ const Collection::List collections = fetchJob->collections();
+ if (collections.isEmpty()) {
+ qCWarning(AKONADIAGENTBASE_LOG) << "The fetch job returned empty collection set. This is unexpected.";
+ q->cancelTask(i18n("Failed to retrieve collection for sync."));
+ return;
+ }
+ q->retrieveItems(collections.at(0));
}
int ResourceBase::itemSyncBatchSize() const