mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
LibWeb: Add null checks before derefencing Bitmaps in ImageStyleValue
This commit is contained in:
parent
b0e7d59b8b
commit
07fb0882bf
1 changed files with 6 additions and 6 deletions
|
@ -1720,22 +1720,22 @@ bool ImageStyleValue::equals(StyleValue const& other) const
|
||||||
|
|
||||||
Optional<int> ImageStyleValue::natural_width() const
|
Optional<int> ImageStyleValue::natural_width() const
|
||||||
{
|
{
|
||||||
if (resource())
|
if (auto* b = bitmap(0); b != nullptr)
|
||||||
return bitmap(0)->width();
|
return b->width();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<int> ImageStyleValue::natural_height() const
|
Optional<int> ImageStyleValue::natural_height() const
|
||||||
{
|
{
|
||||||
if (resource())
|
if (auto* b = bitmap(0); b != nullptr)
|
||||||
return bitmap(0)->height();
|
return b->height();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageStyleValue::paint(PaintContext& context, Gfx::IntRect const& dest_rect, CSS::ImageRendering image_rendering) const
|
void ImageStyleValue::paint(PaintContext& context, Gfx::IntRect const& dest_rect, CSS::ImageRendering image_rendering) const
|
||||||
{
|
{
|
||||||
if (resource())
|
if (auto* b = bitmap(m_current_frame_index); b != nullptr)
|
||||||
context.painter().draw_scaled_bitmap(dest_rect, *bitmap(m_current_frame_index), bitmap(0)->rect(), 1.0f, to_gfx_scaling_mode(image_rendering));
|
context.painter().draw_scaled_bitmap(dest_rect, *b, bitmap(0)->rect(), 1.0f, to_gfx_scaling_mode(image_rendering));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void serialize_color_stop_list(StringBuilder& builder, auto const& color_stop_list)
|
static void serialize_color_stop_list(StringBuilder& builder, auto const& color_stop_list)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue