Pārlūkot izejas kodu

fix(GraphicalVoiceEntry): `parentStaffEntry` undefined

There are cases in which `parentStaffEntry` is undefined (and `parentVoiceEntry` as well) leading to an exception. Therefore, I create a default set of engraving rules. I cannot think of a way to retrieve the instance of the engraving rules at that point. Do I miss anything?
Daniel Fürst 5 gadi atpakaļ
vecāks
revīzija
874a614455
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      src/MusicalScore/Graphical/GraphicalVoiceEntry.ts

+ 2 - 1
src/MusicalScore/Graphical/GraphicalVoiceEntry.ts

@@ -20,7 +20,8 @@ export class GraphicalVoiceEntry extends GraphicalObject {
         this.parentStaffEntry = parentStaffEntry;
         this.PositionAndShape = new BoundingBox(this, parentStaffEntry ? parentStaffEntry.PositionAndShape : undefined, true);
         this.notes = [];
-        this.rules = parentStaffEntry.parentMeasure.parentSourceMeasure.Rules;
+        this.rules = parentStaffEntry ?
+                        parentStaffEntry.parentMeasure.parentSourceMeasure.Rules : new EngravingRules();
     }
 
     public parentVoiceEntry: VoiceEntry;