1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:07:35 +00:00

LibWeb: Return null if an unknown canvas context type is requested

This commit is contained in:
K-Adam 2021-07-27 20:42:28 +02:00 committed by Andreas Kling
parent 7f1677d574
commit 95f393ebcd

View file

@ -47,7 +47,8 @@ RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node()
CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type) CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type)
{ {
VERIFY(type == "2d"); if (type != "2d")
return nullptr;
if (!m_context) if (!m_context)
m_context = CanvasRenderingContext2D::create(*this); m_context = CanvasRenderingContext2D::create(*this);
return m_context; return m_context;