Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG rendering panics when size_hint w or h is 0 #3825

Closed
amPerl opened this issue Jan 15, 2024 · 0 comments · Fixed by #3826
Closed

SVG rendering panics when size_hint w or h is 0 #3825

amPerl opened this issue Jan 15, 2024 · 0 comments · Fixed by #3826
Labels
bug Something is broken

Comments

@amPerl
Copy link
Contributor

amPerl commented Jan 15, 2024

Describe the bug
The initial frame in the images example results in a size_hint of [4984.0, 0.0] passed to the ferris SVG. Prior to #3719 an invalid size hint for a SVG would error out while creating the pixmap, but now it runs into an unwrap on creating an IntSize, triggering a panic.

To Reproduce
Steps to reproduce the behavior:

  1. Checkout 0.25.0 or 963be24
  2. Add cc.egui_ctx.set_pixels_per_point(2.0); to the app creator in examples/images/src/main.rs
  3. Run the example with cargo run -p images
  4. Get thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', crates\egui_extras\src\image.rs:248:83 at IntSize::from_wh(w, h).unwrap() because h is 0 from available_size

Expected behavior
There is no panic

Desktop (please complete the following information):

  • OS: Windows
  • Version 0.25.0
@amPerl amPerl added the bug Something is broken label Jan 15, 2024
emilk pushed a commit that referenced this issue Jan 16, 2024
Added error messages when scaling to invalid sizes instead of panicking
through unwrap, returning to previous behavior.

Closes <#3825>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant