From 39e9dcd4f5523ce4df743dfbce4a468e7685d0fa Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Tue, 6 Apr 2021 16:37:06 +0200 Subject: [PATCH] Fix VersionUpgrade48to49 crashing if there is no "categories_expanded" If the 4.8 is started from a clean install and no category gets expanded in the settings panel, then the "categories_expanded" key will not exist in the [cura] preferences in cura.cfg. As a result, when the 4.9 gets started in this specific case, the version upgrade 48 to 49 will produce a crash and will be considered as "failed", which will then lead to cura requesting from the user to go from the entire onboarding flow instead of landing on the "What's new" pages (even though everything else has been properly updated). This commit fixes that by checking whether the "categories_expanded" key exists in the cura.cfg. --- .../VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py b/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py index 789830ef08..bf21a6867d 100644 --- a/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py +++ b/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py @@ -29,7 +29,7 @@ class VersionUpgrade48to49(VersionUpgrade): # Update visibility settings to include new top_bottom category parser["general"]["visible_settings"] += ";top_bottom" - if any([setting in parser["cura"]["categories_expanded"] for setting in self._moved_visibility_settings]): + if "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" result = io.StringIO()