From 4fcb1be734772829283e694271f54aebb1ccbdd2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 17 Sep 2021 13:05:56 +0200 Subject: [PATCH] LibWeb: Skip rendering box-shadow blur if we don't have memory for it A slight loss in graphical fidelity is better than not rendering the page at all. --- Userland/Libraries/LibWeb/Layout/Box.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp index 85ad404327..f371e4da25 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.cpp +++ b/Userland/Libraries/LibWeb/Layout/Box.cpp @@ -282,6 +282,11 @@ void Box::paint_box_shadow(PaintContext& context) }; auto new_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, bitmap_rect.size()); + if (!new_bitmap) { + dbgln("Unable to allocate temporary bitmap for box-shadow rendering"); + return; + } + Gfx::Painter painter(*new_bitmap); painter.fill_rect({ { 2 * blur_radius, 2 * blur_radius }, enclosed_int_rect.size() }, box_shadow_data->color);