Skip to content

Commit 5512d54

Browse files
committed
Fix regression in vector "save as" that saved shapefiles as .dbf only (fixes #14158)
1 parent 8346601 commit 5512d54

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/app/ogr/qgsvectorlayersaveasdialog.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -395,21 +395,24 @@ QStringList QgsVectorLayerSaveAsDialog::layerOptions() const
395395
case QgsVectorFileWriter::Int:
396396
{
397397
QSpinBox* sb = mLayerOptionsGroupBox->findChild<QSpinBox*>( it.key() );
398-
options << QString( "%1=%2" ).arg( it.key() ).arg( sb->value() );
398+
if ( sb )
399+
options << QString( "%1=%2" ).arg( it.key() ).arg( sb->value() );
399400
break;
400401
}
401402

402403
case QgsVectorFileWriter::Set:
403404
{
404405
QComboBox* cb = mLayerOptionsGroupBox->findChild<QComboBox*>( it.key() );
405-
options << QString( "%1=%2" ).arg( it.key(), cb->currentText() );
406+
if ( cb && !cb->itemData( cb->currentIndex() ).isNull() )
407+
options << QString( "%1=%2" ).arg( it.key(), cb->currentText() );
406408
break;
407409
}
408410

409411
case QgsVectorFileWriter::String:
410412
{
411413
QLineEdit* le = mLayerOptionsGroupBox->findChild<QLineEdit*>( it.key() );
412-
options << QString( "%1=%2" ).arg( it.key(), le->text() );
414+
if ( le )
415+
options << QString( "%1=%2" ).arg( it.key(), le->text() );
413416
break;
414417
}
415418

src/core/qgsvectorfilewriter.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,8 @@ QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()
683683
<< "ARCZ"
684684
<< "POLYGONZ"
685685
<< "MULTIPOINTZ",
686-
"NULL" // Default value
686+
QString(), // Default value
687+
true // Allow None
687688
) );
688689

689690
layerOptions.insert( "ENCODING", new SetOption(

0 commit comments

Comments
 (0)