diff options
| author | PgBiel <9021226+PgBiel@users.noreply.github.com> | 2025-02-10 07:39:04 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-10 10:39:04 +0000 |
| commit | 3fba256405c4aae9f121a07ddaa29cc10b825fc9 (patch) | |
| tree | a6c85d201a84ab13e305dce570e56c6a77546406 /crates/typst-layout/src | |
| parent | e4f8e57c534db8a31d51e0342c46b913a7e22422 (diff) | |
Don't crash on image with zero DPI (#5835)
Diffstat (limited to 'crates/typst-layout/src')
| -rw-r--r-- | crates/typst-layout/src/image.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crates/typst-layout/src/image.rs b/crates/typst-layout/src/image.rs index d963ea50..3e5b7d8b 100644 --- a/crates/typst-layout/src/image.rs +++ b/crates/typst-layout/src/image.rs @@ -95,6 +95,8 @@ pub fn layout_image( } else { // If neither is forced, take the natural image size at the image's // DPI bounded by the available space. + // + // Division by DPI is fine since it's guaranteed to be positive. let dpi = image.dpi().unwrap_or(Image::DEFAULT_DPI); let natural = Axes::new(pxw, pxh).map(|v| Abs::inches(v / dpi)); Size::new( |
