0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

fix: yaml_dialog.py added return None if no file path is specified

This commit is contained in:
wyzula-jan
2023-10-31 11:17:18 +01:00
parent d52aa15aac
commit ff1d918d43

View File

@ -32,6 +32,9 @@ def load_yaml(instance) -> dict:
print(f"An error occurred while loading the settings from {file_path}: {e}") print(f"An error occurred while loading the settings from {file_path}: {e}")
return None # Return None on exception to indicate failure return None # Return None on exception to indicate failure
if not file_path:
return None
def save_yaml(instance, config: dict) -> 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}") print(f"Settings saved to {file_path}")
except Exception as e: except Exception as e:
print(f"An error occurred while saving the settings to {file_path}: {e}") print(f"An error occurred while saving the settings to {file_path}: {e}")
if not file_path:
return None