Fix crash when visible_settings is missing from pre-4.8 project files

Found this while testing the new Qt interface.
This commit is contained in:
Ghostkeeper 2022-02-24 16:31:32 +01:00
parent 9fa6698da3
commit 60c91b5680
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -29,9 +29,10 @@ class VersionUpgrade48to49(VersionUpgrade):
parser["general"]["version"] = "7"
# Update visibility settings to include new top_bottom category
parser["general"]["visible_settings"] += ";top_bottom"
if "visible_settings" in parser["general"]:
parser["general"]["visible_settings"] += ";top_bottom"
if "categories_expanded" in parser["cura"] and any([setting in parser["cura"]["categories_expanded"] for setting in self._moved_visibility_settings]):
if "cura" in parser and "categories_expanded" in parser["cura"] and any([setting in parser["cura"]["categories_expanded"] for setting in self._moved_visibility_settings]):
parser["cura"]["categories_expanded"] += ";top_bottom"
# If the account scope in 4.8 is outdated, delete it so that the user is enforced to log in again and get the