mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Avoid a segfault when NULL layer is passed to vector writer
This commit is contained in:
parent
aa121bf67a
commit
2d35b16aae
@ -21,7 +21,12 @@ public:
|
|||||||
NoError = 0,
|
NoError = 0,
|
||||||
ErrDriverNotFound,
|
ErrDriverNotFound,
|
||||||
ErrCreateDataSource,
|
ErrCreateDataSource,
|
||||||
ErrCreateLayer
|
ErrCreateLayer,
|
||||||
|
ErrAttributeTypeUnsupported,
|
||||||
|
ErrAttributeCreationFailed,
|
||||||
|
ErrProjection, // added in 1.5
|
||||||
|
ErrFeatureWriteFailed, // added in 1.6
|
||||||
|
ErrInvalidLayer, // added in 2.0
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Write contents of vector layer to a shapefile
|
/** Write contents of vector layer to a shapefile
|
||||||
|
@ -588,6 +588,11 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
|
|||||||
QgsCoordinateTransform* ct = 0;
|
QgsCoordinateTransform* ct = 0;
|
||||||
int shallTransform = false;
|
int shallTransform = false;
|
||||||
|
|
||||||
|
if ( layer == NULL )
|
||||||
|
{
|
||||||
|
return ErrInvalidLayer;
|
||||||
|
}
|
||||||
|
|
||||||
if ( destCRS && destCRS->isValid() )
|
if ( destCRS && destCRS->isValid() )
|
||||||
{
|
{
|
||||||
// This means we should transform
|
// This means we should transform
|
||||||
|
@ -53,6 +53,7 @@ class CORE_EXPORT QgsVectorFileWriter
|
|||||||
ErrAttributeCreationFailed,
|
ErrAttributeCreationFailed,
|
||||||
ErrProjection, // added in 1.5
|
ErrProjection, // added in 1.5
|
||||||
ErrFeatureWriteFailed, // added in 1.6
|
ErrFeatureWriteFailed, // added in 1.6
|
||||||
|
ErrInvalidLayer, // added in 2.0
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Write contents of vector layer to a shapefile
|
/** Write contents of vector layer to a shapefile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user