#20287: Checking if layoutIndexValue is != -1

WorkItem: 20187
This commit is contained in:
Stanley Goldman
2013-10-07 08:08:05 -04:00
committed by Sebastien Ros
parent 17f6c975ef
commit 4c16256245

View File

@@ -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)];
}
}