Skip to content

Commit cd8e707

Browse files
committed
Guard against index out of bounds errors in View All Nav logic
1 parent b310067 commit cd8e707

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builder/patternlab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ var entity_encoder = new he();
367367
navViewAllSubItem.patternPartial = "viewall-" + pattern.patternGroup + "-" + pattern.patternSubGroup;
368368

369369
//check if we are moving to a new sub section in the next loop
370-
if (pattern.patternSubGroup !== patternlab.patterns[i + 1].patternSubGroup) {
370+
if (!patternlab.patterns[i + 1] || pattern.patternSubGroup !== patternlab.patterns[i + 1].patternSubGroup) {
371371
navItem.navSubItems.push(navViewAllSubItem);
372372
navItem.navSubItemsIndex.push("View All");
373373
}

0 commit comments

Comments
 (0)