Replace assertion by condition
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 7 Feb 2015 16:05:58 +0000 (17:05 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sat, 7 Feb 2015 16:05:58 +0000 (17:05 +0100)
While the condition should be always true, clang-analyzer still
complained about it. So turn this into a condition instead.

Worst case we'll just lose the item selection now.

src/uisupport/flatproxymodel.cpp

index 80d14f2..bd6dcd0 100644 (file)
@@ -204,8 +204,9 @@ QItemSelection FlatProxyModel::mapSelectionToSource(const QItemSelection &proxyS
             row++;
         }
 
-        Q_ASSERT(topLeftItem && bottomRightItem); // there should be one range left.
-        sourceSelection << QItemSelectionRange(mapToSource(createIndex(topLeftItem->pos(), left, topLeftItem)), mapToSource(createIndex(bottomRightItem->pos(), right, bottomRightItem)));
+        if (topLeftItem && bottomRightItem) { // there should be one range left.
+            sourceSelection << QItemSelectionRange(mapToSource(createIndex(topLeftItem->pos(), left, topLeftItem)), mapToSource(createIndex(bottomRightItem->pos(), right, bottomRightItem)));
+        }
     }
 
     return sourceSelection;