Skip to content

Commit 0415c61

Browse files
committed
Guard vector file writer against invalid layers
instead of crashing. Fixes #21856 Funded by: QCooperative.net
1 parent d673c6f commit 0415c61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/qgsvectorfilewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2453,7 +2453,7 @@ QgsVectorFileWriter::SaveVectorOptions::SaveVectorOptions()
24532453

24542454
QgsVectorFileWriter::WriterError QgsVectorFileWriter::prepareWriteAsVectorFormat( QgsVectorLayer *layer, const QgsVectorFileWriter::SaveVectorOptions &options, QgsVectorFileWriter::PreparedWriterDetails &details )
24552455
{
2456-
if ( !layer )
2456+
if ( !layer || !layer->isValid() )
24572457
{
24582458
return ErrInvalidLayer;
24592459
}

0 commit comments

Comments
 (0)