mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 01:42:17 +00:00
LibWeb: Don't crash when setting offscreen canvas size to 0
Previously, this would crash because `Gfx::Bitmap` can't have a zero size.
This commit is contained in:
parent
f882c446cb
commit
5413716802
Notes:
github-actions[bot]
2025-07-04 15:11:48 +00:00
Author: https://github.com/tcl3
Commit: 5413716802
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5255
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 78 additions and 18 deletions
|
@ -45,6 +45,11 @@ static void default_source_size(CanvasImageSource const& image, float& source_wi
|
|||
[&source_width, &source_height](GC::Root<OffscreenCanvas> const& source) {
|
||||
auto const bitmap = source->bitmap();
|
||||
|
||||
if (!bitmap) {
|
||||
source_width = 0;
|
||||
source_height = 0;
|
||||
return;
|
||||
}
|
||||
source_width = bitmap->width();
|
||||
source_height = bitmap->height();
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue