diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Handlers/FieldIndexPartHandler.cs b/src/Orchard.Web/Modules/Orchard.Projections/Handlers/FieldIndexPartHandler.cs index faa2ca07c..e5100c7f3 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Handlers/FieldIndexPartHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Handlers/FieldIndexPartHandler.cs @@ -48,7 +48,10 @@ namespace Orchard.Projections.Handlers { } } private void Updated(UpdateContentContext context, FieldIndexPart fieldIndexPart) { - if (context.UpdatingItemVersionRecord.Latest) { // updates projection draft indexes only if it is the latest version + // there are two different item types: saved in memory and saved to db + // those saved in memory don't have correctly the populated record and this generate NullReferenceException + if (context.UpdatingItemVersionRecord != null && context.UpdatingItemVersionRecord.Latest) { + // updates projection draft indexes only if it is the latest version DescribeValuesToindex(fieldIndexPart, (indexServiceContext) => { _draftFieldIndexService.Set(fieldIndexPart, indexServiceContext.LocalPart.PartDefinition.Name, @@ -113,4 +116,4 @@ namespace Orchard.Projections.Handlers { } } -} \ No newline at end of file +}