diff --git a/Tests/LibWeb/Text/expected/HTML/HTMLSelectElement-with-detached-option.txt b/Tests/LibWeb/Text/expected/HTML/HTMLSelectElement-with-detached-option.txt
new file mode 100644
index 00000000000..3a2d263b041
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/HTML/HTMLSelectElement-with-detached-option.txt
@@ -0,0 +1 @@
+ PASS (didn't crash)
diff --git a/Tests/LibWeb/Text/input/HTML/HTMLSelectElement-with-detached-option.html b/Tests/LibWeb/Text/input/HTML/HTMLSelectElement-with-detached-option.html
new file mode 100644
index 00000000000..cb6905bc256
--- /dev/null
+++ b/Tests/LibWeb/Text/input/HTML/HTMLSelectElement-with-detached-option.html
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp
index f7b89a9a1d6..28c09bd3680 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Node.cpp
@@ -320,8 +320,10 @@ Node& Node::shadow_including_root()
// The shadow-including root of an object is its root’s host’s shadow-including root,
// if the object’s root is a shadow root; otherwise its root.
auto& node_root = root();
- if (is(node_root))
- return static_cast(node_root).host()->shadow_including_root();
+ if (is(node_root)) {
+ if (auto* host = static_cast(node_root).host(); host)
+ return host->shadow_including_root();
+ }
return node_root;
}