mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#19613: Fixing an issue where MenuItem.Position is null, throwing an exception in NavigationManager.Arrange.
Work Item: 19613 --HG-- branch : 1.x
This commit is contained in:
@@ -192,12 +192,14 @@ namespace Orchard.Core.Navigation.Services {
|
|||||||
var index = new Dictionary<string, MenuItem>();
|
var index = new Dictionary<string, MenuItem>();
|
||||||
|
|
||||||
foreach (var item in items) {
|
foreach (var item in items) {
|
||||||
MenuItem parent = null;
|
MenuItem parent;
|
||||||
var parentPosition = String.Empty;
|
var parentPosition = String.Empty;
|
||||||
|
|
||||||
var lastSegment = item.Position.LastIndexOf('.');
|
var position = item.Position ?? String.Empty;
|
||||||
|
|
||||||
|
var lastSegment = position.LastIndexOf('.');
|
||||||
if (lastSegment != -1) {
|
if (lastSegment != -1) {
|
||||||
parentPosition = item.Position.Substring(0, lastSegment);
|
parentPosition = position.Substring(0, lastSegment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.TryGetValue(parentPosition, out parent)) {
|
if (index.TryGetValue(parentPosition, out parent)) {
|
||||||
@@ -207,9 +209,9 @@ namespace Orchard.Core.Navigation.Services {
|
|||||||
result.Add(item);
|
result.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!index.ContainsKey(item.Position)) {
|
if (!index.ContainsKey(position)) {
|
||||||
// prevent invalid positions
|
// prevent invalid positions
|
||||||
index.Add(item.Position, item);
|
index.Add(position, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user