Skip to content

Commit 7bbd1ca

Browse files
committedNov 5, 2018
[ogr] do not crash if ogr layer is null
1 parent 147608e commit 7bbd1ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/providers/ogr/qgsogrprovider.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,15 +892,16 @@ QStringList QgsOgrProvider::_subLayers( bool withFeatureCount ) const
892892
void QgsOgrProvider::setEncoding( const QString &e )
893893
{
894894
QgsSettings settings;
895-
if ( ( mGDALDriverName == QLatin1String( "ESRI Shapefile" ) && settings.value( QStringLiteral( "qgis/ignoreShapeEncoding" ), true ).toBool() ) || !mOgrLayer->TestCapability( OLCStringsAsUTF8 ) )
895+
if ( ( mGDALDriverName == QLatin1String( "ESRI Shapefile" ) &&
896+
settings.value( QStringLiteral( "qgis/ignoreShapeEncoding" ), true ).toBool() ) ||
897+
( mOgrLayer && !mOgrLayer->TestCapability( OLCStringsAsUTF8 ) ) )
896898
{
897899
QgsVectorDataProvider::setEncoding( e );
898900
}
899901
else
900902
{
901903
QgsVectorDataProvider::setEncoding( QStringLiteral( "UTF-8" ) );
902904
}
903-
904905
loadFields();
905906
}
906907

0 commit comments

Comments
 (0)
Please sign in to comment.