Skip to content

Commit 93bc31d

Browse files
committedSep 6, 2017
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 3b839ce commit 93bc31d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/core/qgsvectorfilewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()
10321032
"Note that the schema file isn't actually accessed by OGR, so it "
10331033
"is up to the user to ensure it will match the schema of the OGR "
10341034
"produced GML data file." ),
1035-
QLatin1String( "" ) // Default value
1035+
QString() // Default value
10361036
) );
10371037

10381038
datasetOptions.insert( QStringLiteral( "XSISCHEMA" ), new SetOption(
@@ -3225,7 +3225,7 @@ QStringList QgsVectorFileWriter::concatenateOptions( const QMap<QString, QgsVect
32253225
case QgsVectorFileWriter::String:
32263226
{
32273227
QgsVectorFileWriter::StringOption *opt = dynamic_cast<QgsVectorFileWriter::StringOption *>( option );
3228-
if ( opt )
3228+
if ( opt && !opt->defaultValue.isNull() )
32293229
{
32303230
list.append( QStringLiteral( "%1=%2" ).arg( it.key(), opt->defaultValue ) );
32313231
}

0 commit comments

Comments
 (0)