From 646bfb02f2ceac5dc82652e9cd68c8b969e47bca Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Tue, 8 Oct 2019 18:55:44 +0200 Subject: [PATCH] Check if value is null or whitespace before reading grid configuration --- src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs index 2c2c69d181..f782f09289 100644 --- a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs @@ -78,20 +78,20 @@ namespace Umbraco.Web.PropertyEditors if (editorValue.Value == null) return null; - var config = editorValue.DataTypeConfiguration as GridConfiguration; - var mediaParent = config?.MediaParentId; - var mediaParentId = mediaParent == null ? Guid.Empty : mediaParent.Guid; - // editorValue.Value is a JSON string of the grid var rawJson = editorValue.Value.ToString(); if (rawJson.IsNullOrWhiteSpace()) return null; + var config = editorValue.DataTypeConfiguration as GridConfiguration; + var mediaParent = config?.MediaParentId; + var mediaParentId = mediaParent == null ? Guid.Empty : mediaParent.Guid; + var grid = DeserializeGridValue(rawJson, out var rtes); var userId = _umbracoContextAccessor.UmbracoContext?.Security.CurrentUser.Id ?? Constants.Security.SuperUserId; - //process the rte values + // Process the rte values foreach (var rte in rtes) { // Parse the HTML