Skip to content

Commit d173b70

Browse files
committed
leave last attribute empty instead of first
because though fid appears to be the first field it's added in the end and has the last index. fixes #20276
1 parent 59686e7 commit d173b70

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/core/qgsofflineediting.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,9 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit
763763
// NOTE: SpatiaLite provider ignores position of geometry column
764764
// fill gap in QgsAttributeMap if geometry column is not last (WORKAROUND)
765765
QgsAttributes attrs = f.attributes();
766-
int column = 0;
767766
// on GPKG newAttrs has an addition FID attribute, so we have to add a dummy in the original set
768-
if ( containerType == GPKG )
769-
column++;
770-
QgsAttributes newAttrs( attrs.count() + column );
767+
QgsAttributes newAttrs( containerType == GPKG ? attrs.count() + 1 : attrs.count() );
768+
int column = 0;
771769
for ( int it = 0; it < attrs.count(); ++it )
772770
{
773771
newAttrs[column++] = attrs.at( it );

0 commit comments

Comments
 (0)