LibHTML: LayoutImage should not dereference a null bitmap

This was happening when trying to render a bitmap that we couldn't
decode properly.
This commit is contained in:
Andreas Kling 2019-11-18 20:26:32 +01:00
parent 89a0d873ba
commit a12292bd03
Notes: sideshowbarker 2024-07-19 11:09:02 +09:00

View file

@ -48,9 +48,8 @@ void LayoutImage::render(RenderingContext& context)
if (alt.is_empty())
alt = node().src();
context.painter().draw_text(enclosing_int_rect(rect()), alt, TextAlignment::Center, style().color_or_fallback(CSS::PropertyID::Color, document(), Color::Black), TextElision::Right);
} else {
} else if (node().bitmap())
context.painter().draw_scaled_bitmap(enclosing_int_rect(rect()), *node().bitmap(), node().bitmap()->rect());
}
LayoutReplaced::render(context);
}