Skip to content

Commit e7f70ab

Browse files
committed
#18164 Checkout - Fix "Cannot read property 'code' on undefined" issue
1 parent 11d9560 commit e7f70ab

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
@@ -24,11 +24,17 @@ define([
2424

2525
/** @inheritdoc */
2626
initialize: function () {
27+
var steps;
28+
2729
this._super();
2830
$(window).hashchange(_.bind(stepNavigator.handleHash, stepNavigator));
2931

3032
if (!window.location.hash) {
31-
stepNavigator.setHash(stepNavigator.steps().sort(stepNavigator.sortItems)[0].code);
33+
steps = stepNavigator.steps();
34+
35+
if (steps.length) {
36+
stepNavigator.setHash(steps.sort(stepNavigator.sortItems)[0].code);
37+
}
3238
}
3339

3440
stepNavigator.handleHash();

0 commit comments

Comments
 (0)