Skip to content

Commit

Permalink
[ogr] do not crash if ogr layer is null
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Nov 5, 2018
1 parent 147608e commit 7bbd1ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -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();
}

Expand Down

0 comments on commit 7bbd1ca

Please sign in to comment.