Merge pull request #6130 from stevemegson/v8/temp-6060

V8: Handle missing grid values in migration from 7.15
This commit is contained in:
Warren Buckley
2019-08-27 14:31:52 +00:00
committed by GitHub
2 changed files with 3 additions and 3 deletions
@@ -50,10 +50,10 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_1_0
var obj = JsonConvert.DeserializeObject<JObject>(value); var obj = JsonConvert.DeserializeObject<JObject>(value);
var allControls = obj.SelectTokens("$.sections..rows..areas..controls"); var allControls = obj.SelectTokens("$.sections..rows..areas..controls");
foreach (var control in allControls.SelectMany(c => c)) foreach (var control in allControls.SelectMany(c => c).OfType<JObject>())
{ {
var controlValue = control["value"]; var controlValue = control["value"];
if (controlValue.Type == JTokenType.String) if (controlValue?.Type == JTokenType.String)
{ {
control["value"] = UpdateMediaUrls(mediaLinkPattern, controlValue.Value<string>()); control["value"] = UpdateMediaUrls(mediaLinkPattern, controlValue.Value<string>());
} }
@@ -43,7 +43,7 @@ namespace Umbraco.Web.PropertyEditors
// TODO: If it's not a string, then it's a json formatted value - // TODO: If it's not a string, then it's a json formatted value -
// we cannot really index this in a smart way since it could be 'anything' // we cannot really index this in a smart way since it could be 'anything'
if (controlVal.Type == JTokenType.String) if (controlVal?.Type == JTokenType.String)
{ {
var str = controlVal.Value<string>(); var str = controlVal.Value<string>();
str = XmlHelper.CouldItBeXml(str) ? str.StripHtml() : str; str = XmlHelper.CouldItBeXml(str) ? str.StripHtml() : str;