summaryrefslogtreecommitdiff
path: root/crates/typst-cli/src
diff options
context:
space:
mode:
author+merlan #flirora <uruwi@protonmail.com>2024-06-22 04:59:52 -0400
committerGitHub <noreply@github.com>2024-06-22 08:59:52 +0000
commit781eea632f68c478c0a96495f7f4822ba6f7873d (patch)
tree1866cda18d077cc36b76f9a661491cb4bea8f638 /crates/typst-cli/src
parent3d3489fbaef7524655f5c911e0bf6dec7394f90e (diff)
Add message when trying to access a field that is not set (#4399)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-cli/src')
-rw-r--r--crates/typst-cli/src/query.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/typst-cli/src/query.rs b/crates/typst-cli/src/query.rs
index a8012777..ef3c7951 100644
--- a/crates/typst-cli/src/query.rs
+++ b/crates/typst-cli/src/query.rs
@@ -88,7 +88,7 @@ fn format(elements: Vec<Content>, command: &QueryCommand) -> StrResult<String> {
let mapped: Vec<_> = elements
.into_iter()
.filter_map(|c| match &command.field {
- Some(field) => c.get_by_name(field),
+ Some(field) => c.get_by_name(field).ok(),
_ => Some(c.into_value()),
})
.collect();