1
Vote

Exception in MenuWidgetPartDriver

description

An ArgumentOutOfRangeException is thrown when a breadcrumb widget is rendered on a page that isn't part of the menu.

Repro:
  1. Start with a vanilla Orchard installation
  2. Go to the admin and create a new menu widget in any zone
  3. Give the widget any title and check "Display as breadcrumb", leave all other settings ontouched and save
  4. Go back to the front end and sign out
  5. Click "Sign In"
Expected: Nothing special
Actual: An ArgumentOutOfRangeException is thrown and logged when hitting ~/Users/Account/LogOn

This happens because in MenuWidgetPartDriver (line 104) result does not contain the current page and is therefore possibly empty.

Proposed fix:
Replace
if (!part.AddCurrentPage) {
    result.RemoveAt(result.Count - 1);
}
with
if (!part.AddCurrentPage && selectedPath != null) {
    result.RemoveAt(result.Count - 1);
}

comments

sebastienros wrote Oct 25, 2013 at 9:48 PM

I fixed this one two weeks ago in 1.7.x but please validate that

JasperD wrote Oct 25, 2013 at 10:30 PM

I can see that you worked on the menu (96cd45f and 964d56d), but that wasn’t about breadcrumbs and I can still repro using 56c6d9d.