In MappingManager::reorderMapping added some extra check to make sure we're sending an appropriate QVector<uid> (no repetition in the uids).

This commit is contained in:
Tats
2014-10-16 18:24:55 +00:00
parent 2f75e4d2ca
commit 96b55099de
+5
View File
@@ -149,11 +149,16 @@ QVector<Mapping::ptr> MappingManager::getVisibleMappings() const
void MappingManager::reorderMappings(QVector<uid> mappingIds)
{
// Both vector needs to have the same size.
Q_ASSERT( mappingIds.size() == mappingVector.size() );
mappingVector.clear();
for (QVector<uid>::iterator it = mappingIds.begin(); it != mappingIds.end(); ++it)
{
// Uid should be a key of the mappingMap.
Q_ASSERT( mappingMap.contains(*it) );
// Makes sure the uids are not repeated.
Q_ASSERT( !mappingVector.contains(mappingMap[*it]) );
// Adds the mapping at the right place in the vector.
mappingVector.push_back( mappingMap[*it] );
}
}