Skip to content

Commit

Permalink
leave last attribute empty instead of first
Browse files Browse the repository at this point in the history
because though fid appears to be the first field it's added in the end and has the last index.

fixes #20276

(cherry-picked from d173b70)
  • Loading branch information
signedav committed Dec 11, 2018
1 parent 06d5545 commit 20ea3d6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/qgsofflineediting.cpp
Expand Up @@ -763,11 +763,9 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit
// NOTE: SpatiaLite provider ignores position of geometry column
// fill gap in QgsAttributeMap if geometry column is not last (WORKAROUND)
QgsAttributes attrs = f.attributes();
int column = 0;
// on GPKG newAttrs has an addition FID attribute, so we have to add a dummy in the original set
if ( containerType == GPKG )
column++;
QgsAttributes newAttrs( attrs.count() + column );
QgsAttributes newAttrs( containerType == GPKG ? attrs.count() + 1 : attrs.count() );
int column = 0;
for ( int it = 0; it < attrs.count(); ++it )
{
newAttrs[column++] = attrs.at( it );
Expand Down

0 comments on commit 20ea3d6

Please sign in to comment.