Skip to content

Commit 497dc51

Browse files
authored
Fix crash when lyrics startBar is over bars length (#439)
1 parent 671507a commit 497dc51

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/model/Track.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class Track {
9393
let staff: Staff = this.staves[0];
9494
for (let li: number = 0; li < lyrics.length; li++) {
9595
let lyric: Lyrics = lyrics[li];
96-
if (lyric.startBar >= 0) {
96+
if (lyric.startBar >= 0 && lyric.startBar < staff.bars.length) {
9797
let beat: Beat | null = staff.bars[lyric.startBar].voices[0].beats[0];
9898
for (let ci: number = 0; ci < lyric.chunks.length && beat; ci++) {
9999
// skip rests and empty beats

0 commit comments

Comments
 (0)