Skip to content

Commit 47978d7

Browse files
committed
#18164 Checkout - Fix "Cannot read property 'code' on undefined" issue
1 parent 80469a6 commit 47978d7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ define([
2323

2424
/** @inheritdoc */
2525
initialize: function () {
26+
var steps;
27+
2628
this._super();
2729
window.addEventListener('hashchange', _.bind(stepNavigator.handleHash, stepNavigator));
2830

2931
if (!window.location.hash) {
30-
stepNavigator.setHash(stepNavigator.steps().sort(stepNavigator.sortItems)[0].code);
32+
steps = stepNavigator.steps();
33+
34+
if (steps.length) {
35+
stepNavigator.setHash(steps.sort(stepNavigator.sortItems)[0].code);
36+
}
3137
}
3238

3339
stepNavigator.handleHash();

0 commit comments

Comments
 (0)