Skip to content
Permalink
Browse files
Fix overwriting default style of geopackage layers
Credit to @rouault for the fix!

Fixes #42811

(cherry picked from commit eef6939)
  • Loading branch information
nyalldawson committed Nov 1, 2021
1 parent 663db59 commit 935fb7c226d2deed5d0f098713590f78757d1fd4
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/core/providers/ogr/qgsogrprovider.cpp
@@ -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 )
@@ -6887,6 +6888,7 @@ QString QgsOgrProviderMetadata::loadStyle( const QString &uri, QString &errCause

}
}
OGR_L_ResetReading( hLayer );

return styleQML;
}
@@ -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;
}

0 comments on commit 935fb7c

Please sign in to comment.