Don't try to load material and quality settings if there aren't any.

Don't throw on cura file in release.
This commit is contained in:
Lars Brubaker 2016-06-22 09:47:01 -07:00
parent 25e3e862b0
commit 56ee8d81b0
2 changed files with 22 additions and 14 deletions

View file

@ -47,31 +47,37 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
if (fromVersion < 201605131)
{
var materialLayers = jObject["MaterialLayers"] as JObject;
foreach (JProperty layer in materialLayers.Properties().ToList())
if (materialLayers != null)
{
layer.Remove();
foreach (JProperty layer in materialLayers.Properties().ToList())
{
layer.Remove();
string layerID = Guid.NewGuid().ToString();
string layerID = Guid.NewGuid().ToString();
var body = layer.Value as JObject;
body["MatterControl.LayerID"] = layerID;
body["MatterControl.LayerName"] = layer.Name;
var body = layer.Value as JObject;
body["MatterControl.LayerID"] = layerID;
body["MatterControl.LayerName"] = layer.Name;
materialLayers[layerID] = layer.Value;
materialLayers[layerID] = layer.Value;
}
}
var qualityLayers = jObject["QualityLayers"] as JObject;
foreach (JProperty layer in qualityLayers.Properties().ToList())
if (qualityLayers != null)
{
layer.Remove();
foreach (JProperty layer in qualityLayers.Properties().ToList())
{
layer.Remove();
string layerID = Guid.NewGuid().ToString();
string layerID = Guid.NewGuid().ToString();
var body = layer.Value as JObject;
body["MatterControl.LayerID"] = layerID;
body["MatterControl.LayerName"] = layer.Name;
var body = layer.Value as JObject;
body["MatterControl.LayerID"] = layerID;
body["MatterControl.LayerName"] = layer.Name;
qualityLayers[layerID] = layer.Value;
qualityLayers[layerID] = layer.Value;
}
}