LibWeb: Don't crash when creating empty bitmap from a HTMLCanvasElement

This commit is contained in:
Tim Ledbetter 2025-07-20 04:14:43 +01:00 committed by Shannon Booth
commit 48417152df
Notes: github-actions[bot] 2025-07-20 04:28:03 +00:00
10 changed files with 527 additions and 2 deletions

View file

@ -143,8 +143,8 @@ void ImageBitmap::close()
void ImageBitmap::set_bitmap(RefPtr<Gfx::Bitmap> bitmap)
{
m_bitmap = move(bitmap);
m_width = m_bitmap->width();
m_height = m_bitmap->height();
m_width = m_bitmap ? m_bitmap->width() : 0;
m_height = m_bitmap ? m_bitmap->height() : 0;
}
Gfx::Bitmap* ImageBitmap::bitmap() const