Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 57d649d

Browse files
committedMar 20, 2019
[processing] Fix warning when loading algorithm dialog and no layers
are present Fixes #21631
1 parent 5f3f081 commit 57d649d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
 

‎python/plugins/processing/gui/wrappers.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,12 +1591,15 @@ def setLayer(self, layer):
15911591
if isinstance(layer, QgsProcessingFeatureSourceDefinition):
15921592
layer, ok = layer.source.valueAsString(self.context.expressionContext())
15931593
if isinstance(layer, str):
1594-
layer = QgsProcessingUtils.mapLayerFromString(layer, self.context)
1595-
if not isinstance(layer, QgsVectorLayer) or not layer.isValid():
1596-
self.dialog.messageBar().clearWidgets()
1597-
self.dialog.messageBar().pushMessage("", self.tr("Could not load selected layer/table. Dependent field could not be populated"),
1598-
level=Qgis.Warning, duration=5)
1599-
return
1594+
if not layer: # empty string
1595+
layer = None
1596+
else:
1597+
layer = QgsProcessingUtils.mapLayerFromString(layer, self.context)
1598+
if not isinstance(layer, QgsVectorLayer) or not layer.isValid():
1599+
self.dialog.messageBar().clearWidgets()
1600+
self.dialog.messageBar().pushMessage("", self.tr("Could not load selected layer/table. Dependent field could not be populated"),
1601+
level=Qgis.Warning, duration=5)
1602+
return
16001603

16011604
self._layer = layer
16021605

0 commit comments

Comments
 (0)
Please sign in to comment.