mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-04 00:30:59 -05:00
addVectorLayerPrivate(): avoid crash in the non-nominal case when added a layer for a non-existing provider
This commit is contained in:
parent
d7ea384f8a
commit
099df0bf3d
@ -11395,7 +11395,7 @@ QgsVectorLayer *QgisApp::addVectorLayerPrivate( const QString &vectorLayerPath,
|
||||
{
|
||||
if ( guiWarning )
|
||||
{
|
||||
QString message = layer->dataProvider()->error().message( QgsErrorMessage::Text );
|
||||
QString message = layer->dataProvider() ? layer->dataProvider()->error().message( QgsErrorMessage::Text ) : tr( "Invalid provider" );
|
||||
QString msg = tr( "The layer %1 is not a valid layer and can not be added to the map. Reason: %2" ).arg( vectorLayerPath, message );
|
||||
visibleMessageBar()->pushMessage( tr( "Layer is not valid" ), msg, Qgis::Critical, messageTimeout() );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user