From 94968892e6217108945bee1528c7c2040f8c37ce Mon Sep 17 00:00:00 2001 From: Liam Jones Date: Wed, 25 May 2022 23:41:27 +0100 Subject: [PATCH] moved creation of nextIndex to be just before it's needed --- src/js/tour.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/tour.js b/src/js/tour.js index 40763825b..92cb75bbf 100644 --- a/src/js/tour.js +++ b/src/js/tour.js @@ -351,10 +351,11 @@ export class Tour extends Evented { */ _skipStep(step, forward) { const index = this.steps.indexOf(step); - const nextIndex = forward ? index + 1 : index - 1; + if (index === this.steps.length - 1) { this.complete(); } else { + const nextIndex = forward ? index + 1 : index - 1; this.show(nextIndex, forward); } }