Skip to content

Commit

Permalink
QgsVectorFilewriter skip default null options
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
m-kuhn committed Sep 6, 2017
1 parent 3b839ce commit 93bc31d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsvectorfilewriter.cpp
Expand Up @@ -1032,7 +1032,7 @@ QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()
"Note that the schema file isn't actually accessed by OGR, so it "
"is up to the user to ensure it will match the schema of the OGR "
"produced GML data file." ),
QLatin1String( "" ) // Default value
QString() // Default value
) );

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

0 comments on commit 93bc31d

Please sign in to comment.