summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/model
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-library/src/model
parent04fd0acacab8cf2e82268da9c18ef4bcf37507dc (diff)
Disallow empty labels and references (#5776) (#6332)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-library/src/model')
-rw-r--r--crates/typst-library/src/model/bibliography.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/typst-library/src/model/bibliography.rs b/crates/typst-library/src/model/bibliography.rs
index e1a07359..f56f5813 100644
--- a/crates/typst-library/src/model/bibliography.rs
+++ b/crates/typst-library/src/model/bibliography.rs
@@ -321,7 +321,11 @@ impl Bibliography {
for d in data.iter() {
let library = decode_library(d)?;
for entry in library {
- match map.entry(Label::new(PicoStr::intern(entry.key()))) {
+ let label = Label::new(PicoStr::intern(entry.key()))
+ .ok_or("bibliography contains entry with empty key")
+ .at(d.source.span)?;
+
+ match map.entry(label) {
indexmap::map::Entry::Vacant(vacant) => {
vacant.insert(entry);
}