summaryrefslogtreecommitdiff
blob: d119a3aae077dc7f90c92413c4f63f2093ca1b92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
commit d76aeb18fbc346e89481ce9b3157b4518e8485f7
Author: Volker Krause <vkrause@kde.org>
Date:   Wed Jul 31 17:14:10 2013 +0200

    Don't crash the server if all items already have the desired flags.
    
    This case subsequently hits an assert in the query builder for an empty
    IN condition.

diff --git a/server/src/storage/datastore.cpp b/server/src/storage/datastore.cpp
index 41a0927..40b8fe8 100644
--- a/server/src/storage/datastore.cpp
+++ b/server/src/storage/datastore.cpp
@@ -235,6 +235,9 @@ bool DataStore::doAppendItemsFlag( const PimItem::List &items, const Flag &flag,
     appendItems << item;
   }
 
+  if ( appendItems.isEmpty() )
+    return true; // all items have the desired flags already
+
   QueryBuilder qb2( PimItemFlagRelation::tableName(), QueryBuilder::Insert );
   qb2.setColumnValue( PimItemFlagRelation::leftColumn(), appendIds );
   qb2.setColumnValue( PimItemFlagRelation::rightColumn(), flagIds );