From 4c1625624535b3f79f7b80e863e9865c69be2cf7 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 7 Oct 2013 08:08:05 -0400 Subject: [PATCH] #20287: Checking if layoutIndexValue is != -1 WorkItem: 20187 --- .../Orchard.Projections/Drivers/ProjectionPartDriver.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Drivers/ProjectionPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Projections/Drivers/ProjectionPartDriver.cs index 2a685b3f5..f20940a12 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Drivers/ProjectionPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Drivers/ProjectionPartDriver.cs @@ -310,8 +310,10 @@ namespace Orchard.Projections.Drivers { var layoutIndex = context.Attribute(part.PartDefinition.Name, "LayoutIndex"); int layoutIndexValue; if (layoutIndex != null - && Int32.TryParse(layoutIndex, out layoutIndexValue) - && part.Record.QueryPartRecord.Layouts.Count >= layoutIndexValue + 1) { + && Int32.TryParse(layoutIndex, out layoutIndexValue) + && layoutIndexValue != -1 + && part.Record.QueryPartRecord.Layouts.Count >= layoutIndexValue + 1) + { part.Record.LayoutRecord = part.Record.QueryPartRecord.Layouts[Int32.Parse(layoutIndex)]; } }