Skip to content
Permalink
Browse files
fix some crash on invalid layers
  • Loading branch information
jef-n committed Jun 13, 2015
1 parent 244f998 commit 34488f85b309c05bd94f94a38692417a51e3f6fb
Showing with 8 additions and 4 deletions.
  1. +1 −1 src/core/qgsvectorfilewriter.cpp
  2. +7 −3 src/core/qgsvectorlayer.cpp
@@ -1867,7 +1867,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe

QGis::WkbType wkbType = layer->wkbType();

if ( layer->providerType() == "ogr" )
if ( layer->providerType() == "ogr" && layer->dataProvider() )
{
QStringList theURIParts = layer->dataProvider()->dataSourceUri().split( "|" );
QString srcFileName = theURIParts[0];
@@ -2858,7 +2858,7 @@ int QgsVectorLayer::fieldNameIndex( const QString& fieldName ) const

bool QgsVectorLayer::addJoin( const QgsVectorJoinInfo& joinInfo )
{
return mJoinBuffer->addJoin( joinInfo );
return mJoinBuffer && mJoinBuffer->addJoin( joinInfo );
}

void QgsVectorLayer::checkJoinLayerRemove( QString theLayerId )
@@ -2868,12 +2868,16 @@ void QgsVectorLayer::checkJoinLayerRemove( QString theLayerId )

void QgsVectorLayer::removeJoin( const QString& joinLayerId )
{
mJoinBuffer->removeJoin( joinLayerId );
if ( mJoinBuffer )
mJoinBuffer->removeJoin( joinLayerId );
}

const QList< QgsVectorJoinInfo >& QgsVectorLayer::vectorJoins() const
{
return mJoinBuffer->vectorJoins();
if ( mJoinBuffer )
return mJoinBuffer->vectorJoins();
else
return QList< QgsVectorJoinInfo >();
}

int QgsVectorLayer::addExpressionField( const QString& exp, const QgsField& fld )

0 comments on commit 34488f8

Please sign in to comment.