Skip to content

Commit 21822a0

Browse files
committed
QgsVectorFilewriter skip default null options
Don't specify dataset options which have null default values. Setting these as empty strings might introduce a different behavior than expected. For example not creating an xsd companion file for GML.
1 parent 9c7b4f0 commit 21822a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/qgsvectorfilewriter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()
10221022
"Note that the schema file isn't actually accessed by OGR, so it "
10231023
"is up to the user to ensure it will match the schema of the OGR "
10241024
"produced GML data file." ),
1025-
QLatin1String( "" ) // Default value
1025+
QString() // Default value
10261026
) );
10271027

10281028
datasetOptions.insert( QStringLiteral( "XSISCHEMA" ), new SetOption(
@@ -3215,7 +3215,7 @@ QStringList QgsVectorFileWriter::concatenateOptions( const QMap<QString, QgsVect
32153215
case QgsVectorFileWriter::String:
32163216
{
32173217
QgsVectorFileWriter::StringOption *opt = dynamic_cast<QgsVectorFileWriter::StringOption *>( option );
3218-
if ( opt )
3218+
if ( opt && !opt->defaultValue.isNull() )
32193219
{
32203220
list.append( QStringLiteral( "%1=%2" ).arg( it.key(), opt->defaultValue ) );
32213221
}

0 commit comments

Comments
 (0)