Skip to content
Permalink
Browse files

Guard vector file writer against invalid layers

instead of crashing.

Fixes #21856

Funded by: QCooperative.net
  • Loading branch information
elpaso authored and nyalldawson committed Apr 22, 2019
1 parent 1337969 commit adb646fc6f20ff5e5b0ead8b5d560ca0e1fb7ab0
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/core/qgsvectorfilewriter.cpp
@@ -2453,7 +2453,7 @@ QgsVectorFileWriter::SaveVectorOptions::SaveVectorOptions()

QgsVectorFileWriter::WriterError QgsVectorFileWriter::prepareWriteAsVectorFormat( QgsVectorLayer *layer, const QgsVectorFileWriter::SaveVectorOptions &options, QgsVectorFileWriter::PreparedWriterDetails &details )
{
if ( !layer )
if ( !layer || !layer->isValid() )
{
return ErrInvalidLayer;
}

0 comments on commit adb646f

Please sign in to comment.
You can’t perform that action at this time.