summaryrefslogtreecommitdiff
path: root/crates/typst-eval
diff options
context:
space:
mode:
authorSaid A. <47973576+Daaiid@users.noreply.github.com>2025-06-26 11:18:51 +0200
committerGitHub <noreply@github.com>2025-06-26 09:18:51 +0000
commit5dd5771df03a666fe17930b0b071b06266e5937f (patch)
tree68a79a843f7b813aea70733b75b7df45a938ee0d /crates/typst-eval
parent04fd0acacab8cf2e82268da9c18ef4bcf37507dc (diff)
Disallow empty labels and references (#5776) (#6332)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-eval')
-rw-r--r--crates/typst-eval/src/markup.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/typst-eval/src/markup.rs b/crates/typst-eval/src/markup.rs
index 5beefa91..9118ded5 100644
--- a/crates/typst-eval/src/markup.rs
+++ b/crates/typst-eval/src/markup.rs
@@ -205,7 +205,9 @@ impl Eval for ast::Label<'_> {
type Output = Value;
fn eval(self, _: &mut Vm) -> SourceResult<Self::Output> {
- Ok(Value::Label(Label::new(PicoStr::intern(self.get()))))
+ Ok(Value::Label(
+ Label::new(PicoStr::intern(self.get())).expect("unexpected empty label"),
+ ))
}
}
@@ -213,7 +215,8 @@ impl Eval for ast::Ref<'_> {
type Output = Content;
fn eval(self, vm: &mut Vm) -> SourceResult<Self::Output> {
- let target = Label::new(PicoStr::intern(self.target()));
+ let target = Label::new(PicoStr::intern(self.target()))
+ .expect("unexpected empty reference");
let mut elem = RefElem::new(target);
if let Some(supplement) = self.supplement() {
elem.push_supplement(Smart::Custom(Some(Supplement::Content(