Initialise config_name

Just a mistake that I saw because my IDE warned me about this. If a variant in Cura 2.3 has no general/name keyword, then it would break here. Now it doesn't break any more and gives a nonsensical name.

Contributes to issue CURA-3427.
This commit is contained in:
Ghostkeeper 2017-05-11 17:33:46 +02:00
parent 0a84a181c4
commit 6e01c6ba60
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -77,6 +77,7 @@ class VersionUpgrade22to24(VersionUpgrade):
with open(variant_path, "r") as fhandle: with open(variant_path, "r") as fhandle:
variant_config.read_file(fhandle) variant_config.read_file(fhandle)
config_name = "Unknown Variant"
if variant_config.has_section("general") and variant_config.has_option("general", "name"): if variant_config.has_section("general") and variant_config.has_option("general", "name"):
config_name = variant_config.get("general", "name") config_name = variant_config.get("general", "name")
if config_name.endswith("_variant"): if config_name.endswith("_variant"):