Skip to content

Commit

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

Fixes #42811

(cherry picked from commit eef6939)
  • Loading branch information
nyalldawson committed Oct 5, 2021
1 parent 332ba6e commit e96f912
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -6676,6 +6676,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 @@ -6887,6 +6888,7 @@ QString QgsOgrProviderMetadata::loadStyle( const QString &uri, QString &errCause

}
}
OGR_L_ResetReading( hLayer );

return styleQML;
}
Expand Down Expand Up @@ -7049,6 +7051,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 e96f912

Please sign in to comment.