From 6a931273a65dee6852b6802f2f9f2abaa11039fe Mon Sep 17 00:00:00 2001 From: tmoxon Date: Thu, 1 Oct 2015 14:42:32 +0100 Subject: [PATCH] The indexing api would break if an indexer was created with a public property defaulting to a null value. This would result in an object reference error in the admin system. Added null check and warning to the log. --- .../WebServices/ExamineManagementApiController.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/WebServices/ExamineManagementApiController.cs b/src/Umbraco.Web/WebServices/ExamineManagementApiController.cs index 136e2a984a..01e9f30254 100644 --- a/src/Umbraco.Web/WebServices/ExamineManagementApiController.cs +++ b/src/Umbraco.Web/WebServices/ExamineManagementApiController.cs @@ -258,9 +258,16 @@ namespace Umbraco.Web.WebServices //ignore these properties .Where(x => new[] {"IndexerData", "Description", "WorkingFolder"}.InvariantContains(x.Name) == false) .OrderBy(x => x.Name); + foreach (var p in props) { - indexerModel.ProviderProperties.Add(p.Name, p.GetValue(indexer, null).ToString()); + var val = p.GetValue(indexer, null); + if (val == null) + { + LogHelper.Warn("Property value was null when setting up property on indexer: " + indexer.Name + " property: " + p.Name); + val = string.Empty; + } + indexerModel.ProviderProperties.Add(p.Name, val.ToString()); } var luceneIndexer = indexer as LuceneIndexer;