Skip to content

Commit

Permalink
[offline editing] fix overwriting of first field on remote layer when…
Browse files Browse the repository at this point in the history
… it has virtual fields (#44999)
  • Loading branch information
3nids committed Sep 9, 2021
1 parent 4601394 commit e84f013
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/qgsofflineediting.cpp
Expand Up @@ -1000,12 +1000,15 @@ void QgsOfflineEditing::applyFeaturesAdded( QgsVectorLayer *offlineLayer, QgsVec
{
// NOTE: SpatiaLite provider ignores position of geometry column
// restore gap in QgsAttributeMap if geometry column is not last (WORKAROUND)
QMap<int, int> attrLookup = attributeLookup( offlineLayer, remoteLayer );
const QMap<int, int> attrLookup = attributeLookup( offlineLayer, remoteLayer );
QgsAttributes newAttrs( newAttrsCount );
const QgsAttributes attrs = it->attributes();
for ( int it = 0; it < attrs.count(); ++it )
{
const int remoteAttributeIndex = attrLookup[ it ];
const int remoteAttributeIndex = attrLookup.value( it, -1 );
// if virtual or non existing field
if ( remoteAttributeIndex == -1 )
continue;
QVariant attr = attrs.at( it );
if ( remoteLayer->fields().at( remoteAttributeIndex ).type() == QVariant::StringList )
{
Expand Down

0 comments on commit e84f013

Please sign in to comment.