diff --git a/Tests/LibWeb/Text/expected/math-with-inline-child.txt b/Tests/LibWeb/Text/expected/math-with-inline-child.txt
new file mode 100644
index 00000000000..aaecaf93c4a
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/math-with-inline-child.txt
@@ -0,0 +1 @@
+PASS (didn't crash)
diff --git a/Tests/LibWeb/Text/input/math-with-inline-child.html b/Tests/LibWeb/Text/input/math-with-inline-child.html
new file mode 100644
index 00000000000..b8d3a4c9eb0
--- /dev/null
+++ b/Tests/LibWeb/Text/input/math-with-inline-child.html
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index 477ec6b20d7..d2b25311403 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -136,6 +136,10 @@ Optional FormattingContext::formatting_context_type_cre
if (display.is_grid_inside())
return Type::Grid;
+ if (display.is_math_inside())
+ // HACK: Instead of crashing, create a dummy formatting context that does nothing.
+ return Type::InternalDummy;
+
if (creates_block_formatting_context(box))
return Type::Block;