Skip to content

Commit b0b3915

Browse files
authored
Merge pull request #112 from deffi/main
Panic if the specified label segment is out of range
2 parents d413967 + 987b15e commit b0b3915

File tree

19 files changed

+37
-24
lines changed

19 files changed

+37
-24
lines changed

src/edge.typ

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,15 @@
922922
// Now that we know the number of segments, we can normalize the label
923923
// positions
924924
edge.label-pos = normalize-position(edge.label-pos, n-segments)
925+
if edge.label-pos.segment < 0 {
926+
panic("Label segment " + str(edge.label-pos.segment) + " must be "
927+
+ "non-negative: " + repr(edge.label))
928+
}
929+
if edge.label-pos.segment >= n-segments {
930+
panic("Label segment " + str(edge.label-pos.segment) + " is out of range"
931+
+ " because the edge only has " + str(n-segments) + " segments: "
932+
+ repr(edge.label))
933+
}
925934

926935
if edge.stroke == none {
927936
// hack: for no stroke, it's easier to do the following.
-16.7 KB
Loading
1.95 KB
Loading
1.85 KB
Loading
1.88 KB
Loading
3.44 KB
Loading
3.57 KB
Loading
1.93 KB
Loading
2.93 KB
Loading
3.02 KB
Loading

0 commit comments

Comments
 (0)