From e48fc5457c16cea2f7b60bc308f177b03a2c6ffb Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 17 Jun 2016 11:13:55 -0700 Subject: [PATCH] Fix regression in preset selection --- SlicerConfiguration/Settings/SettingsProfile.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SlicerConfiguration/Settings/SettingsProfile.cs b/SlicerConfiguration/Settings/SettingsProfile.cs index 9dba268c1..9a787bd4d 100644 --- a/SlicerConfiguration/Settings/SettingsProfile.cs +++ b/SlicerConfiguration/Settings/SettingsProfile.cs @@ -902,7 +902,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { get { - return ValueOrDefault("layer_id"); + string layerKey = ValueOrDefault("layer_id"); + if (string.IsNullOrEmpty(layerKey)) + { + // Generate a new GUID when missing or empty. We can't do this in the constructor as the dictionary deserialization will fail if + // an existing key exists for layer_id and on new empty layers, we still need to construct an initial identifier. + layerKey = Guid.NewGuid().ToString(); + LayerID = layerKey; + } + + return layerKey; } set {