parser: avoid panic
This commit is contained in:
parent
c4a3acaf70
commit
a5d88b64ae
1 changed files with 3 additions and 1 deletions
|
@ -236,8 +236,10 @@ impl<'s> InlineSpans<'s> {
|
||||||
return CowStr::Borrowed(&sp.of(src)[span.start() - a..span.end() - a]);
|
return CowStr::Borrowed(&sp.of(src)[span.start() - a..span.end() - a]);
|
||||||
}
|
}
|
||||||
(span.start() - a)..sp.len()
|
(span.start() - a)..sp.len()
|
||||||
} else {
|
} else if a <= span.end() {
|
||||||
0..sp.len().min(span.end() - a)
|
0..sp.len().min(span.end() - a)
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
s.push_str(&sp.of(src)[r]);
|
s.push_str(&sp.of(src)[r]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue