Fix #2885: Prevent crash on corrupted performance settings
Purpose of PR?:
Fixes #2885
This PR adds a type check to the load_settings method in mslib/msui/flighttrack.py. It ensures that performance_settings is always initialized as a dictionary. If the loaded configuration data is corrupted (e.g., loaded as a str instead of a dict), the application now safely falls back to DEFAULT_PERFORMANCE instead of crashing with a TypeError.
Does this PR introduce a breaking change?
No
If the changes in this PR are manually verified, list down the scenarios covered::
Manually verified by temporarily modifying the code to force performance_settings to be a string ("corrupted data"). Confirmed that the application detected the invalid type, reverted to the default dictionary, and launched successfully without crashing.
Additional information for reviewer? : None
Does this PR results in some Documentation changes? No
Checklist:
- [x] Bug fix. Fixes #2885
- [ ] New feature (Non-API breaking changes that adds functionality)
- [x] PR Title follows the convention of
<type>: <subject> - [ ] Commit has unit tests
It seems the tests failed on test_milestone_url with an AssertionError: Expected milestone format not found.
This appears to be unrelated to my changes in flighttrack.py (likely a network issue or a change in the GitHub HTML response). Could you please re-run the CI?
Please provide a test demonstrating the improved behaviour. I can neither replicate the issue nor validate whether the fix solves anything. Eg a test that fails with the old code, but not with the new one.