Skip to content

Commit

Permalink
Guard vector file writer against invalid layers
Browse files Browse the repository at this point in the history
instead of crashing.

Fixes #21856

Funded by: QCooperative.net
  • Loading branch information
elpaso authored and nyalldawson committed Apr 22, 2019
1 parent 1337969 commit adb646f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/qgsvectorfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit adb646f

Please sign in to comment.