From f615954f76002c249d8a3347347940feb48bd4df Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Mon, 28 Nov 2022 15:00:32 +0100 Subject: [PATCH] fix crash when reference layer is missing (#29) --- .../gui/relation_editor_feature_side_widget.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/document_management_system/gui/relation_editor_feature_side_widget.py b/document_management_system/gui/relation_editor_feature_side_widget.py index 13f07f3..9272508 100644 --- a/document_management_system/gui/relation_editor_feature_side_widget.py +++ b/document_management_system/gui/relation_editor_feature_side_widget.py @@ -235,7 +235,11 @@ def afterSetRelations(self): def _checkTransactionGroup(self): self._layerInSameTransactionGroup = False - connectionString = PluginHelper.connectionString(self.relation().referencedLayer().source()) + referenced_layer = self.relation().referencedLayer() + if not self.relation().referencedLayer(): + return + + connectionString = PluginHelper.connectionString(referenced_layer.source()) transactionGroup = QgsProject.instance().transactionGroup(self.relation().referencedLayer().providerType(), connectionString)