Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix overwriting default style of geopackage layers
Credit to @rouault for the fix!

Fixes #42811
  • Loading branch information
nyalldawson committed Sep 29, 2021
1 parent b843556 commit eef6939
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/providers/ogr/qgsogrprovidermetadata.cpp
Expand Up @@ -391,6 +391,7 @@ bool QgsOgrProviderMetadata::saveStyle(
OGR_L_SetAttributeFilter( hLayer, checkQuery.toUtf8().constData() );
OGR_L_ResetReading( hLayer );
gdal::ogr_feature_unique_ptr hFeature( OGR_L_GetNextFeature( hLayer ) );
OGR_L_ResetReading( hLayer );
bool bNew = true;

if ( hFeature )
Expand Down Expand Up @@ -610,6 +611,7 @@ QString QgsOgrProviderMetadata::loadStyle( const QString &uri, QString &errCause

}
}
OGR_L_ResetReading( hLayer );

return styleQML;
}
Expand Down Expand Up @@ -783,6 +785,7 @@ QString QgsOgrProviderMetadata::getStyleById( const QString &uri, QString styleI
QString styleQML( QString::fromUtf8(
OGR_F_GetFieldAsString( hFeature.get(),
OGR_FD_GetFieldIndex( hLayerDefn, "styleQML" ) ) ) );
OGR_L_ResetReading( hLayer );

return styleQML;
}
Expand Down

0 comments on commit eef6939

Please sign in to comment.