summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-02-28 12:14:45 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-28 14:17:44 +0100
commit0a533da22f8feaf15bcdc2b755e1d140bcf5efbe (patch)
tree4c9bdb5d59a765c448819babc7b959d17ac4e8a8 /Userland/Libraries
parented089586ea50ee6326d874b0491d5e4cec910e4e (diff)
downloadserenity-0a533da22f8feaf15bcdc2b755e1d140bcf5efbe.zip
LibWeb: Don't crash on content with SVG elements outside of <svg>
We'll have to do something more proper to support this scenario eventually, but for now let's at least not crash just because somebody put an SVG <path> inside an HTML element.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/Painting/PaintContext.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/PaintContext.cpp b/Userland/Libraries/LibWeb/Painting/PaintContext.cpp
index 62a3082e04..de287bf394 100644
--- a/Userland/Libraries/LibWeb/Painting/PaintContext.cpp
+++ b/Userland/Libraries/LibWeb/Painting/PaintContext.cpp
@@ -17,6 +17,9 @@ PaintContext::PaintContext(Gfx::Painter& painter, Palette const& palette, Gfx::I
SVGContext& PaintContext::svg_context()
{
+ // FIXME: This is a total hack to avoid crashing on content that has SVG elements embedded directly in HTML without an <svg> element.
+ if (!m_svg_context.has_value())
+ m_svg_context = SVGContext { {} };
return m_svg_context.value();
}