diff --git a/qfieldsync/gui/layers_config_widget.py b/qfieldsync/gui/layers_config_widget.py index 9c592748..eaa7ba62 100644 --- a/qfieldsync/gui/layers_config_widget.py +++ b/qfieldsync/gui/layers_config_widget.py @@ -270,8 +270,11 @@ def _on_message_bus_messaged(self, msg: str) -> None: if msg != "layer_config_saved": return - for layer_source in self.layer_sources: - layer_source.read_layer() + for layer_source in self.layer_sources.copy(): + try: + layer_source.read_layer() + except RuntimeError: + self.layer_sources.remove(layer_source) # quite ugly workaround, but this method sometimes operates on deleted objects, # so we need to make sure we don't get exceptions