Fix freeze when auto-finding broken layers

Fix #37757
This commit is contained in:
Alessandro Pasotti 2020-07-11 17:06:47 +02:00
parent 2e2acf9170
commit 01c3b47806

View File

@ -589,7 +589,7 @@ void QgsHandleBadLayers::autoFind()
// Try first to change the datasource of the existing layers, this will
// maintain the current status (checked/unchecked) and group
if ( QgsProject::instance()->mapLayer( layerId ) )
if ( !datasource.isEmpty() && QgsProject::instance()->mapLayer( layerId ) )
{
QgsDataProvider::ProviderOptions options;
QgsMapLayer *mapLayer = QgsProject::instance()->mapLayer( layerId );