From ff1d918d43f0f2e5fe8d78c6de9051c50e0e12c1 Mon Sep 17 00:00:00 2001 From: wyzula-jan <133381102+wyzula-jan@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:17:18 +0100 Subject: [PATCH] fix: yaml_dialog.py added return None if no file path is specified --- bec_widgets/qt_utils/yaml_dialog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bec_widgets/qt_utils/yaml_dialog.py b/bec_widgets/qt_utils/yaml_dialog.py index 8d26b484..78cda57e 100644 --- a/bec_widgets/qt_utils/yaml_dialog.py +++ b/bec_widgets/qt_utils/yaml_dialog.py @@ -32,6 +32,9 @@ def load_yaml(instance) -> dict: print(f"An error occurred while loading the settings from {file_path}: {e}") return None # Return None on exception to indicate failure + if not file_path: + return None + def save_yaml(instance, config: dict) -> None: """ @@ -57,3 +60,6 @@ def save_yaml(instance, config: dict) -> None: print(f"Settings saved to {file_path}") except Exception as e: print(f"An error occurred while saving the settings to {file_path}: {e}") + + if not file_path: + return None