Skip to content

Commit 2e69531

Browse files
committed
fix(program settings): Make it more robust
1 parent 72a6358 commit 2e69531

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ardupilot_methodic_configurator/backend_filesystem_program_settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ def store_connection(connection_string: str) -> None:
502502

503503
settings = ProgramSettings._get_settings_as_dict()
504504
history = settings.get("connection_history", [])
505+
if not isinstance(history, list):
506+
logging_error("The ProgramSetting connection_history was not a list")
507+
history = []
505508

506509
if connection_string in history:
507510
history.remove(connection_string)

tests/test_backend_filesystem_program_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def test_user_can_load_existing_settings_file(self, mock_user_config, sample_pro
403403
expected_result["annotate_docs_into_param_files"] = False # Added by default
404404
expected_result["gui_complexity"] = "simple" # Added by default
405405
expected_result["motor_test"] = {"duration": 2, "throttle_pct": 10} # Added by default
406-
expected_result["connection_history"] = [] # Added for port connection string to save
406+
expected_result["connection_history"] = [] # Added by default
407407
expected_result["display_usage_popup"]["component_editor_validation"] = True # Added by default
408408
expected_result["display_usage_popup"]["workflow_explanation"] = True # Added by default
409409
expected_result["display_usage_popup"]["bitmask_parameter_editor"] = True # Added by default

0 commit comments

Comments
 (0)