From a12292bd03cf2da631fd118d4149043826bc0589 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 18 Nov 2019 20:26:32 +0100 Subject: [PATCH] LibHTML: LayoutImage should not dereference a null bitmap This was happening when trying to render a bitmap that we couldn't decode properly. --- Libraries/LibHTML/Layout/LayoutImage.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Libraries/LibHTML/Layout/LayoutImage.cpp b/Libraries/LibHTML/Layout/LayoutImage.cpp index e2cb32cd36..2666d2149b 100644 --- a/Libraries/LibHTML/Layout/LayoutImage.cpp +++ b/Libraries/LibHTML/Layout/LayoutImage.cpp @@ -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); }