Explorar o código

Prevent negative topMeasureNumber

Jimmy Utterström %!s(int64=3) %!d(string=hai) anos
pai
achega
37a04afe66
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/OpenSheetMusicDisplay/Cursor.ts

+ 1 - 1
src/OpenSheetMusicDisplay/Cursor.ts

@@ -151,7 +151,7 @@ export class Cursor implements IPlaybackListener {
     this.updateCurrentPageFromSystem(currentSystem);
     const previousStaffEntry: GraphicalStaffEntry = values[2];
 
-    const topMeasureNumber: number = previousStaffEntry.parentMeasure.MeasureNumber;
+    const topMeasureNumber: number = Math.max(previousStaffEntry.parentMeasure.MeasureNumber, 1);
     // we have to find the top measure, otherwise the cursor with type 3 "jumps around" between vertical measures
     let topMeasure: GraphicalMeasure;
     for (const measure of this.graphic.MeasureList[topMeasureNumber - 1]) {