Skip to content

Commit 9a756b8

Browse files
committed
Map sequencer bugfix
1 parent 91ab4f5 commit 9a756b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

whg/webpack/js/mapControls.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class sequencerControl {
2929
this.playing = false;
3030
this.stepdelay = 3;
3131
this.playInterval = null;
32-
this.sortedPIDs = [];
32+
this.sortedPIDs = table ? table.rows({ order: 'current' }).data().map(r => r.properties.pid) : [];
3333

3434
this.buttons = [
3535
['skip-first','First waypoint','Already at first waypoint','Disabled during play'],
@@ -142,6 +142,10 @@ class sequencerControl {
142142
const sequencer = $('.sequencer');
143143

144144
const highlightedPid = $('#placetable tr.highlight-row').attr('pid');
145+
146+
// Guard against undefined sortedPIDs
147+
if (!Array.isArray(this.sortedPIDs) || this.sortedPIDs.length === 0) return;
148+
145149
this.currentSeq = this.sortedPIDs.indexOf(parseInt(highlightedPid));
146150

147151
if (!this.playing) {

0 commit comments

Comments
 (0)