Skip to content

Commit d9cb607

Browse files
Skip empty prevalues
1 parent 0ad782e commit d9cb607

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Umbraco.Deploy.Contrib/Migrators/Legacy/DataType/PreValuesDataTypeArtifactJsonMigrator.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Linq;
12
using Newtonsoft.Json.Linq;
23
using Semver;
34
using Umbraco.Core;
@@ -30,10 +31,17 @@ public override JToken Migrate(JToken artifactJson)
3031

3132
// Convert pre-value serialized JSON to actual JSON objects/arrays
3233
if (propertyValue.Type == JTokenType.String &&
33-
propertyValue.Value<string>() is string json &&
34-
json.DetectIsJson())
34+
propertyValue.Value<string>() is string value)
3535
{
36-
propertyValue = JToken.Parse(json);
36+
if (string.IsNullOrEmpty(value))
37+
{
38+
// Skip empty value
39+
continue;
40+
}
41+
else if (value.DetectIsJson())
42+
{
43+
propertyValue = JToken.Parse(value);
44+
}
3745
}
3846

3947
configuration.Add(property.Name, propertyValue);

0 commit comments

Comments
 (0)