Skip to content

Commit 34488f8

Browse files
committedJun 13, 2015
fix some crash on invalid layers
1 parent 244f998 commit 34488f8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
 

‎src/core/qgsvectorfilewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1867,7 +1867,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
18671867

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

1870-
if ( layer->providerType() == "ogr" )
1870+
if ( layer->providerType() == "ogr" && layer->dataProvider() )
18711871
{
18721872
QStringList theURIParts = layer->dataProvider()->dataSourceUri().split( "|" );
18731873
QString srcFileName = theURIParts[0];

‎src/core/qgsvectorlayer.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,7 +2858,7 @@ int QgsVectorLayer::fieldNameIndex( const QString& fieldName ) const
28582858

28592859
bool QgsVectorLayer::addJoin( const QgsVectorJoinInfo& joinInfo )
28602860
{
2861-
return mJoinBuffer->addJoin( joinInfo );
2861+
return mJoinBuffer && mJoinBuffer->addJoin( joinInfo );
28622862
}
28632863

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

28692869
void QgsVectorLayer::removeJoin( const QString& joinLayerId )
28702870
{
2871-
mJoinBuffer->removeJoin( joinLayerId );
2871+
if ( mJoinBuffer )
2872+
mJoinBuffer->removeJoin( joinLayerId );
28722873
}
28732874

28742875
const QList< QgsVectorJoinInfo >& QgsVectorLayer::vectorJoins() const
28752876
{
2876-
return mJoinBuffer->vectorJoins();
2877+
if ( mJoinBuffer )
2878+
return mJoinBuffer->vectorJoins();
2879+
else
2880+
return QList< QgsVectorJoinInfo >();
28772881
}
28782882

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

0 commit comments

Comments
 (0)
Please sign in to comment.