Skip to content
Permalink
Browse files

[ogr] do not crash if ogr layer is null

  • Loading branch information
elpaso committed Oct 30, 2018
1 parent 147608e commit 7bbd1ca25222e4caa8083d5470df6d15fabaf274
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/providers/ogr/qgsogrprovider.cpp
@@ -892,15 +892,16 @@ QStringList QgsOgrProvider::_subLayers( bool withFeatureCount ) const
void QgsOgrProvider::setEncoding( const QString &e )
{
QgsSettings settings;
if ( ( mGDALDriverName == QLatin1String( "ESRI Shapefile" ) && settings.value( QStringLiteral( "qgis/ignoreShapeEncoding" ), true ).toBool() ) || !mOgrLayer->TestCapability( OLCStringsAsUTF8 ) )
if ( ( mGDALDriverName == QLatin1String( "ESRI Shapefile" ) &&
settings.value( QStringLiteral( "qgis/ignoreShapeEncoding" ), true ).toBool() ) ||
( mOgrLayer && !mOgrLayer->TestCapability( OLCStringsAsUTF8 ) ) )
{
QgsVectorDataProvider::setEncoding( e );
}
else
{
QgsVectorDataProvider::setEncoding( QStringLiteral( "UTF-8" ) );
}

loadFields();
}

0 comments on commit 7bbd1ca

Please sign in to comment.
You can’t perform that action at this time.