mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-31 19:06:34 +08:00
#19687: Fixing possible ArgumentOutOfRange exception when importing projections
Work Item: 19687 --HG-- branch : 1.x
This commit is contained in:
parent
615b0d59dd
commit
dd71ed679b
@ -307,7 +307,10 @@ namespace Orchard.Projections.Drivers {
|
||||
if (query != null) {
|
||||
part.Record.QueryPartRecord = context.GetItemFromSession(query).As<QueryPart>().Record;
|
||||
var layoutIndex = context.Attribute(part.PartDefinition.Name, "LayoutIndex");
|
||||
if (layoutIndex != null && Int32.Parse(layoutIndex) != -1) {
|
||||
int layoutIndexValue;
|
||||
if (layoutIndex != null
|
||||
&& Int32.TryParse(layoutIndex, out layoutIndexValue)
|
||||
&& part.Record.QueryPartRecord.Layouts.Count >= layoutIndexValue + 1) {
|
||||
part.Record.LayoutRecord = part.Record.QueryPartRecord.Layouts[Int32.Parse(layoutIndex)];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user